Ask a Question

ADO Connection

Madhi
Contributor

ADO Connection

DBInstance = "3db60a7a-6443-45ff-8ae6-d05d0d05e007"



Set AConnection = ADO.CreateADOConnection


AConnection = .CreateADOConnection

AConnection.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog="+DBInstance+";Data Source=.\eaudit"


AConnection.LoginPrompt = False


AConnection.Open


QueryText = "SELECT count(*) FROM dbo.tablename"



Set RecSet = AConnection.Execute_(QueryText)


RecSet = AConnection.Execute_(QueryText)

Getcount = RecSet.recordcount


AConnection.Close



Im not able to get the correct record count in this.  I get the anser as 1 instead of 4


3 REPLIES 3
tristaanogre
Esteemed Contributor

The reason being is that you are getting 1 record back from your query consistint of the count... what you need to do is, instead of using record count, get the value from the record present of the first column.




Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Madhi
Contributor

Thank you for your reply.

Do you know the command to retrieve the value.  When i execute the same query, i dont get the column name so i cannot use

Recset.fields(colname).value
Madhi
Contributor

I got it.. recset.fields(0).value



thanks..
cancel
Showing results for 
Search instead for 
Did you mean: