Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

incorrect record count ... 1

Status
Not open for further replies.

shahina

Programmer
Aug 19, 2003
47
IN
Hi..

am using vb & sql server2000 as back end..my problem is it is showing incorrect record count property..i.e,

myrecordset.open"tablename",myconnection,adopenkeyset,adlockoptimistic
when i gave myrecordset.recordcount, it is giving the value -1 though there are lot of data in the table..
my os is windows 2000..can u please help me?

with regards,
shahina.
 
Hello,
Ur recordset is not client side record set, so all the records are not yet fetched to client, thats why u get recordcount -1.

To get proper record count, u must define the recordset as client side by saying its a clientside recordset, buit that will not alow u to update anything in the recordset.
So best option is after open say, rs.MoveLast and then read the record count.

Regards
Soumya
 
Dear soumya,

thank u..ya..i am getting the recordcount when i gave it as adopenstatic, adlockreadonly..but doesn't allow me to update..i have given that rs.movelast and then also it is showing -1..i.e before, movelast i have given openkeyset,adlockoptimistic..

by using rs.open"select count(*) from table", am able to get the record count..

thank u..

with regards,
shahina.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top