Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 SQL query is not Fecthing records

Author  Topic 

aakash.agarwal
Starting Member

2 Posts

Posted - 2008-01-03 : 07:30:32
Hi

I am trying to get a recordset using ADODB with SQL Server2005 but i am getting a record count as -1.
although when i am trying to run the same query with the SQL manager directly it is working fine and i can get the records i wanted.

can anyone help me on this

thanks in advance

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-01-03 : 07:42:25
Record count of -1 does not mean records are not being fetched. Correctness of RecordCount property depends upon the CursorType of the recordset.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-03 : 08:03:13
quote:
Originally posted by aakash.agarwal

Hi

I am trying to get a recordset using ADODB with SQL Server2005 but i am getting a record count as -1.
although when i am trying to run the same query with the SQL manager directly it is working fine and i can get the records i wanted.

can anyone help me on this

thanks in advance


If you use Server side cursor, then dont use recordcount properly instead see if Rs.EOF is true/false. If it is true then there are no records

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

aakash.agarwal
Starting Member

2 Posts

Posted - 2008-01-03 : 13:08:16
Sorry that was my mistake yes it is giving EOF and BOF as true
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-04 : 07:34:19
quote:
Originally posted by aakash.agarwal

Sorry that was my mistake yes it is giving EOF and BOF as true


It means your query doesnt give any data

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -