Do Not Use Single Quotes Around Numeric Fields

Do Not Use Single Quotes Around Numeric Fields


I am trying to insert a record into the database but it doesn’t seem to be working correctly due to the way the database is set up.

Deleted HTML Code

I get this error message:

Disallowed implicit conversion from datatype 'varchar' to datatype 'int' Table: 'calypso.dbo.usr', Column: 'usr_wwid' Use the CONVERT function to run this query. 

The data should just go straight into the database but somehow it doesn't seem to be working. What went wrong here? Do you know how I can use the convert function in this case?


You are trying to put a single quote (') around all the values in your SQL statement?even around the numeric ones. Remove the single quotes from around the numeric fields and you should be all set. Change:

&_"'" & Request.Form("wwid") + "', "&_


&_"" & Request.Form("wwid") + ", "&_

and so on for all numeric fields. Use the single quote only for text and date fields in SQL Server.


Share the Post: