Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Dealing with Count

JMJ33JMJ33 Member Posts: 1
I'm a beginner at ASP programming.

I am using the following statement

MyCommand = New SqlCommand("SELECT Count(*) from Test_Query", MyConnection)

How do I assign the count value to a variable Max_Value.value?

John Manels


  • Sergey.NetSergey.Net Member Posts: 7
    I think better to do this :

    Set Con = Server.CreateObject( "ADODB.Connection" )
    Con.Open("your DSN string here")
    SQL = "SELECT COUNT(*) AS MaxValue FROM Yourtable"
    Set tmpRes = Con.Execute( SQL )
    if not tmpRes.eof then
    maxValue = tmpRes("MaxValue")
    end if
Sign In or Register to comment.