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
 General SQL Server Forums
 Data Corruption Issues
 Recordset can't retrieve data

Author  Topic 

pisoftco
Starting Member

5 Posts

Posted - 2006-11-29 : 06:18:01
I have two dbs with the same table names and fields but different data. My connection is right, as well as my query.
How come that my program can't access the data from one table while the there's no problem with the another one? My recordset is empty even the record I'm searching for exists. It's rs.recordcount is -1. Is that database corrupted?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-29 : 06:21:22
Try to fire same query using Query Analyzer and check whether any records are returned. Also check the value of rs.EOF and rs.BOF..Is it giving TRUE?

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

pisoftco
Starting Member

5 Posts

Posted - 2006-11-29 : 06:39:23
Thanks for your fast reply..
That's another weird thing.. when I use the Query Analyzer, i'm getting results. It's neither EOF nor BOF too.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-29 : 07:12:26
Then how do you know the recordset is empty? simply from recordcount property? RecordCount property won't give you correct answer unless you use propert CursorType for the recordset.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

pisoftco
Starting Member

5 Posts

Posted - 2006-11-29 : 07:20:53
I already tried changing the CursorType too.. :D

Btw, can you tell which CursorTypes work well with RecordCount?

tnx again
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-29 : 07:30:07
Either keyset or static cursor should work.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

pisoftco
Starting Member

5 Posts

Posted - 2006-11-29 : 07:37:03
I'm using keyset.

And like I said, I have tried all CursorTypes already.. Do still have other things in mind?
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-29 : 07:41:56
What method you are using to fill the recordset? direct query or as a result of some stored proc?

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

pisoftco
Starting Member

5 Posts

Posted - 2006-11-29 : 08:12:20
recordset.open strQuery, strConn, ......
Go to Top of Page
   

- Advertisement -