lorena
Well-known member
I am trying to write an application in VB.NET pulls information from an Oracle server and will write it, with other information, to a SQL database.
We established a link between the SQL server and the Oracle db and can successfully use "OPENQUERY" to get data from Oracle via SQL.
My problem is trying to do the same thing in VB.Net. I get this error:
"Could not create an instance of OLE DB provider MSDAORA"
I wrote some lines of codes just to test the connection.
It bombs out with the error message at the "ExecuteReader" statement
Here is my code:
(SQL_PROD10 is the linked server name)
Does anyone have experience with linked servers? I dont and would really appreciate any help! Thanks
We established a link between the SQL server and the Oracle db and can successfully use "OPENQUERY" to get data from Oracle via SQL.
My problem is trying to do the same thing in VB.Net. I get this error:
"Could not create an instance of OLE DB provider MSDAORA"
I wrote some lines of codes just to test the connection.
It bombs out with the error message at the "ExecuteReader" statement
Here is my code:
(SQL_PROD10 is the linked server name)
Code:
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Private Sub continueButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles continueButton.Click
Dim connectionString As String
connectionString = "Data Source=INTRANET\Server1;Initial Catalog=master;Integrated Security=True"
Dim sqlConnection As New SqlClient.SqlConnection(connectionString)
Dim sqlCommand As New SqlCommand("select * from openquery (sql_prod10,Select * from jobno_progno)", sqlConnection)
sqlConnection.Open()
Dim jobNoReader As SqlDataReader = sqlCommand.ExecuteReader()
While jobNoReader.Read
Dim jobnostring As String
jobnostring = CStr(jobNoReader("JobNo"))
Debug.WriteLine("Job No " + jobnostring)
End While
jobNoReader.Close()
End Sub