jjc99
10-20-2011, 03:35 AM
Hi all
I am having trouble returning data to a recordset.
My code is as follows
Dim oCon As ADODB.Connection
Dim oRS As ADODB.Recordset
Set oCon = New ADODB.Connection
oCon.ConnectionString = "Provider=SQLNCLI10;Server=PC-000\SQLEXPRESS;Database=MYDB; Trusted_Connection=yes;"
oCon.Open
Set oRS = New ADODB.Recordset
oRS.ActiveConnection = oCon
oRS.Open ("SELECT * FROM tbl_STUFF")
MsgBox oRS.RecordCount
oRS.Close
oCon.Close
If Not oRS Is Nothing Then Set oRS = Nothing
If Not oCon Is Nothing Then Set oCon = Nothing
The connection appears to be valid as I do not get any errors. However, no data appears to be returned to the dataset.
Any help would be greatly appreciated.
I am having trouble returning data to a recordset.
My code is as follows
Dim oCon As ADODB.Connection
Dim oRS As ADODB.Recordset
Set oCon = New ADODB.Connection
oCon.ConnectionString = "Provider=SQLNCLI10;Server=PC-000\SQLEXPRESS;Database=MYDB; Trusted_Connection=yes;"
oCon.Open
Set oRS = New ADODB.Recordset
oRS.ActiveConnection = oCon
oRS.Open ("SELECT * FROM tbl_STUFF")
MsgBox oRS.RecordCount
oRS.Close
oCon.Close
If Not oRS Is Nothing Then Set oRS = Nothing
If Not oCon Is Nothing Then Set oCon = Nothing
The connection appears to be valid as I do not get any errors. However, no data appears to be returned to the dataset.
Any help would be greatly appreciated.