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.
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 AthalyeIndia."Nothing is Impossible" |
|
|
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. |
|
|
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 AthalyeIndia."Nothing is Impossible" |
|
|
pisoftco
Starting Member
5 Posts |
Posted - 2006-11-29 : 07:20:53
|
I already tried changing the CursorType too.. :DBtw, can you tell which CursorTypes work well with RecordCount?tnx again |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-11-29 : 07:30:07
|
Either keyset or static cursor should work.Harsh AthalyeIndia."Nothing is Impossible" |
|
|
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? |
|
|
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 AthalyeIndia."Nothing is Impossible" |
|
|
pisoftco
Starting Member
5 Posts |
Posted - 2006-11-29 : 08:12:20
|
recordset.open strQuery, strConn, ...... |
|
|
|
|
|