SQLScholar
Programmer
Hi all,
Myself and a work mate are trying to get a connection to SQL and to populate the data from an execute into a recordset. Problem is that it doesnt seem to be working. The rs.recordcount is coming back as -1. There is definitely data there, and the SQL connection is fine (tried an insert using execute and it worked!)
Code below:
Any ideas?
Dan
----------------------------------------
Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss
Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
Myself and a work mate are trying to get a connection to SQL and to populate the data from an execute into a recordset. Problem is that it doesnt seem to be working. The rs.recordcount is coming back as -1. There is definitely data there, and the SQL connection is fine (tried an insert using execute and it worked!)
Code below:
Code:
Dim conn
Dim rs As New ADODB.Recordset
Dim command As New ADODB.Command
Dim objArray
Dim strSql
conn = Server.CreateObject("ADODB.Connection")
conn.open("Driver={SQL Server};Server=xxx;Database=xxx; Uid=xxx;Pwd=xxx;")
strSql = "SELECT * FROM tableName"
With command
.CommandText = strSql
.ActiveConnection = conn
End With
rs = command.Execute
Response.Write(rs.RecordCount)
Any ideas?
Dan
----------------------------------------
Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss
Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------