Dealing with Count - Programmers Heaven

Howdy, Stranger!

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

Categories

Dealing with Count

JMJ33JMJ33 Posts: 1Member
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

Comments

  • Sergey.NetSergey.Net Posts: 7Member
    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

    http://www.hire-programmers.com
Sign In or Register to comment.