Using rs.RecordCount - Get -1 ( minus one) value everytime.....

Hi , im using ASP with VBScript and Mysql

I didnt have a problem when the db was MS access but now have started using it with MySQL..

This is Code for record set...

rs.CursorType = 3
rs.Open strSCat, strConn
rc = rs.RecordCount
response.write rc

Rc value giving me "-1" every time....

Have tried using

rs.Open strSCat, strConn,3,3
rc = rs.RecordCount
response.write rc

but get

2 (This is the value which is correct!)
Microsoft Cursor Engine error '80004005'

Key column information is insufficient or incorrect. Too many rows were affected by update.

/category.asp, line 73

any ideas?


Who is Participating?

Improve company productivity with a Business Account.Sign Up

petoskey-001Connect With a Mentor Commented:

are you using CursorLocation = adUseClient??

rs.CursorLocation = adUseClient

ADO will always return -1 when CursorLocation is set to adUseServer
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Do you have an index/primary key on the MySQL version of the table?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I have seen this also with Primary key defined on datatype where ADO/DAO could not work on correctly (ie .Oracle Timestamp column). What is the table's definition?
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

sgriffinAuthor Commented:
Yes , theres a primary key defined...

Guy Hengel [angelIII / a3]Billing EngineerCommented:
Anyhow, this should work better:
rs.Open strSCat, strConn,1,3

or this:
rs.CursorType = 1
rs.LockType = 3
rs.Open strSCat, strConn
rc = rs.RecordCount
response.write rc

sgriffinAuthor Commented:
Hi Angel ,
tried that and unfortunately no joy :( get -1 again......

Are you still having this problem?  Did you try the CursorLocation fix I suggested?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.