Forum Discussion

Madhi's avatar
Madhi
Contributor
15 years ago

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

  • tristaanogre's avatar
    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.



  • 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