Jump to content

Recommended Posts

Posted

Hello,

 

I have a problem with my script:

 

dim connection

dim recordSet

dim connectionString

dim results

dim sqlQuery

 

set recordSet = Server.CreateObject("ADODB.Recordset")

recordSet.MaxRecords = 100

set connection = Server.CreateObject("ADODB.Connection")

sqlQuery = "SELECT * FROM contacts_tbl"

connectionString = "Provider=sqloledb; Server=JOHNY-PC; Database=organiser; Trusted_Connection=Yes;"

 

connection.Open connectionString

recordSet.Open sqlQuery, connection

Response.Write("

records: " & recordset.Fields.Count)

 

 

So - in the last line I'm checking quantity of returned rows. Whatever is my sqlQuery string, recordSet always reads three rows. Why it is like that? How can I fix it?

Posted
Response.Write("

records: " & recordset.Fields.Count)

 

You seem to be returning a count of the number of fields (columns) in your recordset rather than a count of the records (rows).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...