How do return a single value

Results 1 to 2 of 2

Thread: How do return a single value

  1. #1
    Claes Guest

    Default How do return a single value

    Hi,<BR><BR>I am trying to get the number of recordsets that fullfill<BR>a certain criteria in my database up to my ASP code. I<BR>want to use an SQL sequence like:<BR><BR>SELECT COUNT(people) FROM members WHERE homestate=&#039TX&#039<BR><BR>How do I go about to do this? I am using an Access 2000 <BR>database and ADO 2.5. I have tried various methods with <BR>command and recordsets. The property objRS.RecordCount<BR>doesn&#039t seem to work; but that&#039s a pretty bad idea any-<BR>way, since I don&#039t want to upload the whole recordset <BR>just for obtaining one value!<BR><BR><BR>Claes

  2. #2
    Join Date
    Dec 1969

    Default you're missing one thing in your sql...

    aight, here&#039s how it&#039s supposed to look:<BR><BR>&#060;%<BR>set dbcn=server.createobject("adodb.connection")<BR>db "dsn=mydsn"<BR>sql="select count(people) as acount from members where homestate=&#039TX&#039"<BR>set rstemp=dbcn.execute(sql)<BR>mycount=rstemp("acount ")<BR>response.write mycount<BR>dbcn.close<BR>set dbcn=nothing<BR>%&#062;<BR><BR>you can see where you went wrong i think...what i did was just created an alias db field for the count to take place in...don&#039t worry, it didn&#039t actually create the field in the db...mmk?? hope this helps!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts