Jump to content
skaterdav85

casting form data to integer

Recommended Posts

I have a few hidden input fields that contain integers and I am going to insert these values into a sql server db into fields of type int. I tried using the CAST() function in my query, but it keeps throwing an error saying:[Macromedia]

[sqlServer JDBC Driver][sqlServer]Incorrect syntax near the keyword 'AS'.Is there anything wrong with my query?
<cfquery datasource="db1">INSERT INTO testSetup (id1, id2, id3, position, testStartDate)VALUES(   <cfqueryparam cfsqltype="cf_sql_varchar" value="form.id1">,	CAST(#form.id2# AS INTEGER),	CAST(#form.id3# AS INTEGER),	 1,	<cfqueryparam cfsqltype="cf_sql_varchar" value="form.startDate">)</cfquery>

  • Like 1

Share this post


Link to post
Share on other sites

Whoa, what's up with using your # everywhere instead of their real values like ( and ). Anyways, what type of database are you using, are you sure it supports integer and not int?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...