Storing COUNT in a variable?

Results 1 to 2 of 2

Thread: Storing COUNT in a variable?

  1. #1
    Join Date
    Dec 1969

    Default Storing COUNT in a variable?

    I&#039m trying to store the number of ("Poll_Option") for a specific ID in a variable. My code is below. I&#039m grabbing the count for the number of rows (or options) where the ID equals a certain number. I do a response.write to see if anything is in the optionsCount variable but nothing is returned.<BR><BR>Any suggestions?<BR><BR>Set rsCount=Server.CreateObject("ADODB.Recordset")<BR> strSQL = "SELECT COUNT(Poll_Option) AS optionsCount FROM_<BR>& "csd_poll_options_t WHERE Poll_ID= 84"<BR> rsCount.Open strSQL, objConn<BR><BR>Response.Write optionsCount<BR>Response.End

  2. #2
    schnookums Guest

    Default RE: Storing COUNT in a variable?

    Change your response.write to:<BR><BR> response.write rsCount("optionsCount")<BR><BR>or<BR><BR> response.write rsCount(0)<BR><BR>

Posting Permissions

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