By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,682 Members | 1,401 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,682 IT Pros & Developers. It's quick & easy.

Error when connecting ADO

P: n/a
Dear all,

I am now writing a VB.net application to get data from the Ole Db Provider
which I created in ATL COM before. It work well in my own computer.
However, i have tested this program with other computers; however, when the
program execute some sql query, the error msg "Error in mscorlib, object
reference not set to an instance of an object" showed. The following is how
I call the ADO in the program. Thank you for all of your help.

Public objDrsRS0 As Object 'RecordSet
Public objDrsRS1 As Object 'Recordset
Public objDrsRS2 As Object 'Recordset

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
objDrsConn = New Object
objDrsConn = CreateObject("ADODB.Connection")
objDrsConn.Open("Provider=OledbprovForDBMAN.Oledbp rovForDBMAN.1;")

objDrsRS0 = CreateObject("ADODB.Recordset")
objDrsRS1 = CreateObject("ADODB.Recordset")
objDrsRS2 = CreateObject("ADODB.Recordset")
End Sub
'In a button handle
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
For i = 0 To arryPid.Length - 1
..........
sRet = subGetSeisan(arryPid(i), Visit)
Next
End Sub

Private Function subGetSeisan(ByVal Pidnum As Long, ByVal Visit As Long)
As Short
objDrsRS1.Open...
...
objDrsRS1.Close...
objDrsRS2.Open....
...
objDrsRS2.Close
End Function

Alex yung
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.