WebMatrix and Oracle Connectivity

P

Paul

Dear All,
I am a novice with WebMatrix and see that there is a database
connection facility for both Access and SQL/MSDE. Is there a method of
connecting to an Oracle server either direct or via ODBC MDAORA? and
be able to build your query up through the Code Wizards (i.e SELECT,
INSERT etc).

I have been able to achieve this to some degree by creating a false
connection and then manually changing the ConnectionString in the code
window:-

Dim connectionString As String = "Provider=MSDAORA;Data
Source=MYSERVER;User ID=MYID; Password=MYPASSWORD"

So the complete code look like below:-

Function PRQueryMethod(ByVal productCode As String) As
System.Data.DataSet
Dim connectionString As String = "Provider=MSDAORA;Data
Source=MYSERVER;User ID=MYID; Password=MYPASSWORD"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString)

Dim queryString As String = "SELECT * FROM EMAIL"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_productCode As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_productCode.ParameterName = "@ProductCode"
dbParam_productCode.Value = productCode
dbParam_productCode.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_productCode)

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

The above does work but If I change the query string to pass it a
value, as below:

Dim queryString As String = "SELECT * FROM EMAIL WHERE CSTMR =
@productCode"

I get an error that reports it doesn't like the word PROVIDER in my
connectionString !

So, I need to be able to connect to Oracle Successfully and be to pass
values in my query

Any help appreciated

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top