CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Custom SQL code to add int data

Print topic Send  topic

Author Message
Rene
Posted: 07/16/2002, 9:10 AM

I've created a record form in CCS which is adding data to multiple sql server tables. To do this I'm adding all my data using custom code (an example follows). This seems to work fine, the only problem is that when a user doesn't enter data in a numeric field, a 0 (zero) gets entered in the database...a similar thing happens with date fields - if they don't enter a date a 1/1/1900 gets entered in the database. A co-worker of mine told me that it's because I'm not defining my int and date fields (i.e. customer_num, date_needed) properly in the code below. Can somebody tell me how I need to change the syntax below for int and date fields?

con.Execute("declare @newrfe as int insert into rfe (" _
& "rfe_status," _
& "customer_status," _
& "customer_num," _ (this is an int field)
& "date_needed," _ (this is a date field)
& "customer_notes" _
& ") values (" _
& "'" & Request.Form("rfe_status") & "'," _
& "'" & Request.Form("customer_status") & "'," _
& "'" & Request.Form("customer_num") & "'," _
& "'" & Request.Form("date_needed") & "'," _
& "'" & Request.Form("customer_notes") & "'" _
& ")" _
CodeCharge Support
Posted: 07/17/2002, 5:41 AM

Rene,
To enter NULL value into table instead empty entry use CCToSQL() function in custom query. It returns NULL string for empty value. You’ll find it in common.asp file. For sample code please refer to the insert code for any record form.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.