+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, My recordSet reads only three rows! in Coding and Web Development; Hello, I have a problem with my script: dim connection dim recordSet dim connectionString dim results dim sqlQuery set recordSet ...
  1. #1
    Xakiz's Avatar
    Join Date
    Mar 2011
    Location
    UK
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    My recordSet reads only three rows!

    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("<br>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?

  2. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,686
    Thank Post
    334
    Thanked 513 Times in 481 Posts
    Rep Power
    178
    You trying to count the records, or fields? Shouldn't recordset.Fields.Count be recordset.RecordCount if it's returned rows?

    Steve

  3. #3

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,403
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    Response.Write("<br>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).

  4. #4
    Xakiz's Avatar
    Join Date
    Mar 2011
    Location
    UK
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thank you guys, it is ok now

SHARE:
+ Post New Thread

Similar Threads

  1. [MS Office - 2003] Show standard and formatting toolbars on two rows
    By jonnykewell1 in forum Office Software
    Replies: 1
    Last Post: 16th November 2011, 11:36 AM
  2. [SIMS] Batch export marksheets with summary rows
    By LosOjos in forum MIS Systems
    Replies: 15
    Last Post: 4th February 2011, 07:51 PM
  3. Who reads the small print?
    By laserblazer in forum General Chat
    Replies: 2
    Last Post: 18th April 2010, 12:08 PM
  4. Excel LOOKUP() won't work for first 384 rows
    By smithmath in forum Windows
    Replies: 0
    Last Post: 4th October 2009, 03:32 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •