473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

getting RecordCount = -1

1
Hello Friends,

I have a problem with recordsets.

I m getting Rs.RecordCount = -1 while calling a store procedures

here is code -

Set cmd = Server.CreateObject("ADODB.Command")
Set rs = Server.CreateObject("ADODB.RecordSet")
cmd.ActiveConnection = myCon
cmd.CommandText = "SP_Name"
cmd.CommandType = 4
cmd.CommandTimeout = 300
cmd.Parameters.Append cmd.CreateParameter("@par1",20,1,10,1)
cmd.Parameters.Append cmd.CreateParameter("@par2",20,1,10,1)
cmd.Parameters.Append cmd.CreateParameter("@par3",20,1,10,20)
cmd.Parameters.Append cmd.CreateParameter("@par4",20,1,10,Null)
Rs.CursorLocation = 3
Rs.LockType = 1
Rs.CursorType = 3
Set Rs = cmd.Execute
Response.Write "<br>RecordCount = " & Rs.RecordCount

In Sql Server with same parameter SP gives me 2 records as result.


pls give some usefull solution.
Mar 30 '07 #1
1 3469
jhardman
3,406 Expert 2GB
Hello Friends,

I have a problem with recordsets.

I m getting Rs.RecordCount = -1 while calling a store procedures

here is code -

Set cmd = Server.CreateObject("ADODB.Command")
Set rs = Server.CreateObject("ADODB.RecordSet")
cmd.ActiveConnection = myCon
cmd.CommandText = "SP_Name"
cmd.CommandType = 4
cmd.CommandTimeout = 300
cmd.Parameters.Append cmd.CreateParameter("@par1",20,1,10,1)
cmd.Parameters.Append cmd.CreateParameter("@par2",20,1,10,1)
cmd.Parameters.Append cmd.CreateParameter("@par3",20,1,10,20)
cmd.Parameters.Append cmd.CreateParameter("@par4",20,1,10,Null)
Rs.CursorLocation = 3
Rs.LockType = 1
Rs.CursorType = 3
Set Rs = cmd.Execute
Response.Write "<br>RecordCount = " & Rs.RecordCount

In Sql Server with same parameter SP gives me 2 records as result.


pls give some usefull solution.
I'm not sure I follow your code. You say SQL server gives you 2 records, but doesn't your line RS.CursorLocation... send you to the third out of 2 records?

Jared
Mar 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Mark Watkins | last post by:
I know for a fact that in my database, I have three records under the users table. However when I execute this code: --------------BEGIN CODE---------------- Set objConn =...
2
by: Jeff Boyer | last post by:
Hello everyone, Can someone tell me why a ADO recordset.recordcount would return a -1? I have confirmed that it has records in it by writing some values to the screen. Why can't I count the...
4
by: don.fleming | last post by:
Hi folks: Am doing a VBA SQL Select stmt with multiple rows found and not getting RecordCount > 1. I've verified there are multiple rows found by copying my SQL stmt from Debug window and pasting...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
2
by: rajvbprogramer | last post by:
here is my problem. i have two records. one containing 20 records and second containing 30 records. now i want the recordcount property to use and go to the 21 record. i m calculating the...
1
by: bluepiper | last post by:
Im using VB6. On rowcolchange event of may datagrid, im using the Frame caption to get the selected data. The problem is when I select the data on the grid. Its not showing the absolute position,...
2
by: gilsygirl | last post by:
Hi Good guys I am a newbie in VB 6.0. I want to retrieve records from a database. I want to use three fields from the database as a key to retrieve a record and post this record details to a...
1
by: qqmbers | last post by:
May be it will help someone. I faced the strange problem with RecordCount property of cloned Recordset within the Current event handler. The RecordCount value was correct every time I had...
3
by: sparks | last post by:
Is recordcount a little messed or what? For Each tdf In dbs.TableDefs If Left(tdf.Name, 3) = "tbl" Then Debug.Print tdf.Name Debug.Print tdf.RecordCount it prints the correct name but the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.