Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 RecordCount
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

giambona
New Member

USA
84 Posts

Posted - 30 June 2001 :  13:11:16  Show Profile  Visit giambona's Homepage
I have an ASP page that loops through a query to create a table but it is returning 0 records b/c the recordcount value is -1. Why am i getting -1 for recordcount?

this is what i'm using for my looping code: "for counter = 0 to rstemp.recordcount"

thanks!

HuwR
Forum Admin

United Kingdom
20587 Posts

Posted - 30 June 2001 :  13:16:52  Show Profile  Visit HuwR's Homepage
it is to do with the type of cursor being used to navigate the dataset, how are you opening your queery

Go to Top of Page

giambona
New Member

USA
84 Posts

Posted - 30 June 2001 :  14:29:15  Show Profile  Visit giambona's Homepage
here's the code i'm using to open the query:

quote:

strConn="PROVIDER=MSDASQL;DRIVER={SQL Server};"
strConn=strconn & "SERVER=216.122.236.5;DATABASE=XXXXXXXXX;"
strConn=strconn & "UID=XXXXXXXXX;PWD=XXXXXXXXX;"

dim conntemp, rstemp

mySQL = "SELECT * FROM Merchants"

set conntemp=server.createobject("adodb.connection")
conntemp.open strConn
set rstemp=conntemp.execute(mySQL)



thanks!

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20587 Posts

Posted - 30 June 2001 :  15:10:20  Show Profile  Visit HuwR's Homepage
Try opening it like this

Try opening it like this

rstemp.Open mySQL, conntemp, 3

rather than doing an execute.

Go to Top of Page

giambona
New Member

USA
84 Posts

Posted - 30 June 2001 :  17:04:55  Show Profile  Visit giambona's Homepage
hrmm, now i'm getting this error:

quote:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/coupons.asp, line 77



What is the difference between execute and open?

Thanks!


Go to Top of Page

HuwR
Forum Admin

United Kingdom
20587 Posts

Posted - 30 June 2001 :  17:19:31  Show Profile  Visit HuwR's Homepage
my fault, you need to define the record set

set rstemp=server.createobject("adodb.recordset")


issueing an execute uses a default set of parremeters to connect to the database, using the open command, you can set things like locktype, cursor type etc.


Go to Top of Page

giambona
New Member

USA
84 Posts

Posted - 30 June 2001 :  17:57:50  Show Profile  Visit giambona's Homepage
thanks! it worked!

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07