Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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)


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

Does anyone have experience with linked servers? I don't and would really appreciate any help! Thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...