Dealing with Count

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


  • 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.

Howdy, Stranger!

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


In this Discussion