Author |
Topic  |
|
giambona
New Member

USA
84 Posts |
Posted - 30 June 2001 : 13:11:16
|
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
|
it is to do with the type of cursor being used to navigate the dataset, how are you opening your queery
|
 |
|
giambona
New Member

USA
84 Posts |
Posted - 30 June 2001 : 14:29:15
|
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!
|
 |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 30 June 2001 : 15:10:20
|
Try opening it like this
Try opening it like this
rstemp.Open mySQL, conntemp, 3
rather than doing an execute.
|
 |
|
giambona
New Member

USA
84 Posts |
Posted - 30 June 2001 : 17:04:55
|
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!
|
 |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 30 June 2001 : 17:19:31
|
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.
|
 |
|
giambona
New Member

USA
84 Posts |
Posted - 30 June 2001 : 17:57:50
|
thanks! it worked!
|
 |
|
|
Topic  |
|