If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Recordcount is -1

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-04-03, 14:01
Shineyshoes Shineyshoes is offline
Registered User
 
Join Date: Jan 2003
Posts: 22
Question Recordcount is -1

I have a website that i am converting from MS Access to MS SQL Server. I have a select statement on on page, that worked fine in Access, and currently works fine in Query Analyzer, but wont work properly on the asp page.

The recordcount always comes back -1

anyone help me on why its not wrorking?

Thanks
Reply With Quote
  #2 (permalink)  
Old 02-04-03, 16:17
Memnoch1207 Memnoch1207 is offline
Registered User
 
Join Date: Jan 2003
Location: Midwest
Posts: 138
post the code
Reply With Quote
  #3 (permalink)  
Old 02-04-03, 17:11
ZeligOn ZeligOn is offline
Registered User
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 18
try

Rs.CursorType = 3

after define the recordset.
__________________
Eddie.
Reply With Quote
  #4 (permalink)  
Old 02-04-03, 18:01
Shineyshoes Shineyshoes is offline
Registered User
 
Join Date: Jan 2003
Posts: 22
still no luck

ZeligOn: I get "Operation is not allowed when the object is open"

i tried declaring the recordset then trying to set it but i couldnt get it to work

Memnoch1207:

here is the shortened form........

set objcon = server.createobject("ADODB.connection")

objcon.Open ("Provider=sqloledb;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=mydatabase;" & _
"User ID=xxxx;" & _
"Password=xxxx")


selsql2 = "SELECT tblSites.site_name, tblSites.site_id, " _
& "tblSites.area_id, tblMessages.message_date, " _
& "tblProduction.time, tblProduction.FlowDuration, " _
& "tblProduction.GasVol, tblProduction.AvgSP, " _
& "tblProduction.AvgFT, tblProduction.AvgDP, " _
& "tblProduction.AvgTubP, tblProduction.AvgCasP, " _
& "tblProduction.section_type, tblUserSites.User_ID, " _
& "tblmessages.message_date_no_time FROM " _
& "(tblSites INNER JOIN (tblMessages INNER JOIN tblProduction " _
& "ON tblMessages.message_id = tblProduction.message_id) ON " _
& "tblSites.site_id = tblMessages.site_id) INNER JOIN " _
& "tblUserSites ON tblSites.site_id = tblUserSites.Site_Id " _
& "WHERE (((tblProduction.section_type)=1) AND " _
& "((tblUserSites.site_ID)=14) AND "_
& "((tblUserSites.user_ID)=5) And " _
& "((tblmessages.message_date_no_time) > '1/4/2003')) " _
& "ORDER BY tblmessages.message_date_no_time DESC"

set objrs2 = objcon.execute(selsql2)

'if the data for the site is not todays data, make the font color red, otherwise, make the fontcolor black.
if objrs2.eof then
response.write "<td colspan=6>" & tablefontsize & "Internal Server Error "</td></tr>"
else

Blah blah blah.....
Reply With Quote
  #5 (permalink)  
Old 02-10-03, 05:57
vineetall vineetall is offline
Registered User
 
Join Date: Feb 2003
Posts: 11
Re: Recordcount is -1

Hi this is no surprise, somehow recordcount donot works in oracle and sql server using oledb. Though you can try to open recordset using 1,3,2 in last in rs.open statement where you specify cursor type,location etc

Quote:
Originally posted by Shineyshoes
I have a website that i am converting from MS Access to MS SQL Server. I have a select statement on on page, that worked fine in Access, and currently works fine in Query Analyzer, but wont work properly on the asp page.

The recordcount always comes back -1

anyone help me on why its not wrorking?

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On