Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Dealing with Count Posted by JMJ33 on 30 May 2007 at 6:26 AM
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
Report
Re: Dealing with Count Posted by Sergey.Net on 14 Jun 2007 at 2:32 AM
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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.