Resend my activation email : Register : Log in 
BCF: Bike Chat Forums


First time using SQl server and ADO. Help...?

Reply to topic
Bike Chat Forums Index -> The Geek Zone
View previous topic : View next topic  
Author Message

Cigaro
World Chat Champion



Joined: 28 Mar 2007
Karma :

PostPosted: 17:02 - 11 Nov 2008    Post subject: First time using SQl server and ADO. Help...? Reply with quote

Hi,

I have an Access 2002 application which I am converting to use an SQL server backend instead of a .MDB file. I've linked the tables fine, now I'm trying to work out how to change over all the ADO stuff.

This is the problem I have: Using the code below, I cannot get a recordcount - it always returns -1.

I know my cursor on the recordset is OK, is there something extra I need to specify on the connection object?

I know the connection ETC is OK as I can navigate between records, return record values and field counts.

Code:


Function TestODBC()
    Dim a As New ADODB.Connection
   
    a.Open "driver={SQL Server}; server={vista01\sqlexpress}; database={backend}"
   
    Dim b As New ADODB.Recordset
   
    b.Open "SELECT * FROM Contacts", a, adOpenDynamic, adLockOptimistic
   
   
    MsgBox b.RecordCount
   
End Function

 Back to top
View user's profile Send private message You must be logged in to rate posts

The Shaggy D.A.
Super Spammer



Joined: 12 Sep 2008
Karma :

PostPosted: 17:11 - 11 Nov 2008    Post subject: Reply with quote

If it returns -1, it may be that the property isn't supported.

https://www.w3schools.com/ado/prop_rs_recordcount.asp
____________________
Chances are quite high you are not in my Monkeysphere, and I don't care about you. Don't take it personally.
Currently : Royal Enfield 350 Meteor
Previously : CB100N > CB250RS > XJ900F > GT550 > GPZ750R/1000RX > AJS M16 > R100RT > Bullet 500 > CB500 > LS650P > Bullet Electra X & YBR125 > Bullet 350 "Superstar" & YBR125 Custom > Royal Enfield Classic 500 Despatch Limited Edition (28 of 200) & CB Two-Fifty Nighthawk > ER5
 Back to top
View user's profile Send private message You must be logged in to rate posts
Old Thread Alert!

The last post was made 17 years, 353 days ago. Instead of replying here, would creating a new thread be more useful?
  Display posts from previous:   
This page may contain affiliate links, which means we may earn a small commission if a visitor clicks through and makes a purchase. By clicking on an affiliate link, you accept that third-party cookies will be set.

Post new topic   Reply to topic    Bike Chat Forums Index -> The Geek Zone All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Read the Terms of Use! - Powered by phpBB © phpBB Group
 

Debug Mode: ON - Server: birks (www) - Page Generation Time: 0.06 Sec - Server Load: 0.46 - MySQL Queries: 14 - Page Size: 32.3 Kb