I have this sql code which works fine :

sql = "select count(city) as cx from NY where CITY='New York'"
set rs=conn.execute(sql)
response.write(rs("cx"))

The above counts all records with New York city.

I have been trying to put this on a dynamic .asp page and modify line 1 to grab city field from the page that it is being viewed, I have a field for city which I was trying to place in spot of "New York", can anybody help?

I assume you got a form that has City text box, say its <input ID='city' valye='' name='city' /> Now your sql need to be

sql= "select count(city) as cx from NY where CITY='" & request("city") & "'"

Please check / correct syntax. I am kind of out of touch with classic ASP. Please close thread if this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.