ADO.net Help

  • Thread starter Thread starter Josh
  • Start date Start date
J

Josh

This code isn't working:

'open connection to database
Dim ADOcon As New ADODB.Connection()
Dim rsOverdue As New ADODB.Recordset()
Dim sql As String

ADOcon.Open("allstaff_contact")

'query for high priority overdue prospects
sql = "SELECT * from contactdetail"
rsOverdue.Open(sql, ADOcon,ADODB.CursorTypeEnum.adOpenStatic)

MsgBox(rsOverdue.RecordCount)

I get -1 in the message box. Can you suggest some code that will work please?

Thanks,
Josh
 
Hi Josh,

If you don't have a really good motivation to stick with old Ado, I strongly
suggest you to start using ado.net.
 
100% agreed with Miha, but the below classic ADO code, looks allright, look
into the system dsn, the ability to open a connection, and the query
returning any results or not.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik


Miha Markic said:
Hi Josh,

If you don't have a really good motivation to stick with old Ado, I
strongly suggest you to start using ado.net.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Josh said:
This code isn't working:

'open connection to database
Dim ADOcon As New ADODB.Connection()
Dim rsOverdue As New ADODB.Recordset()
Dim sql As String

ADOcon.Open("allstaff_contact")

'query for high priority overdue prospects
sql = "SELECT * from contactdetail"
rsOverdue.Open(sql, ADOcon,ADODB.CursorTypeEnum.adOpenStatic)

MsgBox(rsOverdue.RecordCount)

I get -1 in the message box. Can you suggest some code that will work
please?

Thanks,
Josh
 
Back
Top