[thelist] ASP Question - Converting varchar to data type int
Phillip Ciske
pciske at gmail.com
Thu Dec 6 10:37:49 CST 2007
> I'm working in ASP and have a data input page which has a 'unique id generator' that is in this format xxxx-xx-xxx-xxx, with the x's being all numeric. The database column is set up to be 'varchar' to allow for the dashes.
> for this code:
> <%strSQL = "SELECT * FROM AMS where MinutesID = " & Request ("id")%>
>
> Is there a way to convert the request string to varchar/non-numeric so that the two can be compared, etc?
If Request("id") is a string, you will need single quotes around the
value in your SQL. For the string xxxx-xx-xxx-xxx, the SQL will
become:
SELECT * FROM AMS WHERE MinutesID = 'xxxx-xx-xxx-xxx'
Your strSQL variable becomes:
<%strSQL = "SELECT * FROM AMS WHERE MinutesID = '" & Request("id") & "'" %>
Phillip
More information about the thelist
mailing list