Hi,
Anyone have any idea as to why this always returns the recordset.count as "-1" no matter how many records there are?
I'm sure I'm missing something obvious, but I'm finding it hard work learning ADO after the joys of the data environment designer - yeah yeah, I know - I used to cheat ;-)
Thanks
Anyone have any idea as to why this always returns the recordset.count as "-1" no matter how many records there are?
Code:
Dim SQLConnection As New ADODB.Connection
SQLConnection.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=(local);Application Name=MyApp"
SQLConnection.Open()
Dim rsAssetSimple As New ADODB.Recordset
rsAssetSimple = SQLConnection.Execute("SELECT * FROM TblAssets")
Do Until rsAssetSimple.EOF
Debug.Write(rsAssetSimple(0).Value & vbCrLf)
Debug.Write(rsAssetSimple.RecordCount & vbCrLf & "-----" & vbCrLf)
rsAssetSimple.MoveNext()
Loop
I'm sure I'm missing something obvious, but I'm finding it hard work learning ADO after the joys of the data environment designer - yeah yeah, I know - I used to cheat ;-)
Thanks