Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » SQL Insert Statement without a value[SOLVED]
SQL Insert Statement without a value[SOLVED] [message #3139] Mon, 08 May 2006 23:17 Go to next message
Justin is currently offline  Justin
Messages: 57
Registered: March 2006
Location: Orange County California
Member
Hi Guys,

I am trying the following insert command and it is working. However, this command does not work if the fields are empty. Is there a simple way for this to work without having to validate each field and create some type of NULL value?




	sql*Insert(NC_SUPPORT)("name", ~supportform.edtName)("company", ~supportform.edtCompany)
						("email", ~supportform.edtEmail)("status", ~supportform.lstStatus)
						("phone", ~supportform.edtPhone)("country", ~supportform.lstCountry)
						("product", ~supportform.lstProduct)("units", ~supportform.edtUnits);




[Updated on: Tue, 09 May 2006 01:44]

Report message to a moderator

Re: SQL Insert Statement without a value [message #3140 is a reply to message #3139] Mon, 08 May 2006 23:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Justin wrote on Mon, 08 May 2006 17:17

Hi Guys,

I am trying the following insert command and it is working. However, this command does not work if the fields are empty. Is there a simple way for this to work without having to validate each field and create some type of NULL value?




	sql*Insert(NC_SUPPORT)("name", ~supportform.edtName)("company", ~supportform.edtCompany)
						("email", ~supportform.edtEmail)("status", ~supportform.lstStatus)
						("phone", ~supportform.edtPhone)("country", ~supportform.lstCountry)
						("product", ~supportform.lstProduct)("units", ~supportform.edtUnits);







I am a little bit surprised it works at all Wink Normal way would be to define column lists as

SqlId COMPANY("COMPANY");

Insert(NC_SUPPORT)(COMPANY, value);

As presented, it would yield string representation in columns list (maybe it is OK with some SQL dialects..)

Now about Nulls - well, empty fields should produce Null. You can easily check/debug most of SqlExp problems by activating SQL trace - that will .log SQL commands going to RDBMS and also error messages reported.

Mirek
Re: SQL Insert Statement without a value [message #3141 is a reply to message #3140] Mon, 08 May 2006 23:42 Go to previous messageGo to next message
Justin is currently offline  Justin
Messages: 57
Registered: March 2006
Location: Orange County California
Member
Embarassed

It's embarrasing, but I wouldn't know how to use the SQL trace debugging feature. I am not a very experienced programmer and I don't know how to use any debugging tools. Can you help me to turn on this type of debugging?



Justin

[Updated on: Mon, 08 May 2006 23:43]

Report message to a moderator

Re: SQL Insert Statement without a value [message #3142 is a reply to message #3141] Tue, 09 May 2006 01:13 Go to previous messageGo to next message
Justin is currently offline  Justin
Messages: 57
Registered: March 2006
Location: Orange County California
Member
I switched Sql and MySQL to 'Full' debug mode in the 'Output mode' window. I also am using the 'LOG' function and am only retrieving 'falses' and 'trues' like this:



* C:\upp\out\MSC8.Debug_full.Gui.Mt\Nstand.exe 08.05.2006 16:08:04, user: Justin

false
false
false
false
false
false
false
false
false
false
false
true
true
true
true
true
true







Re: SQL Insert Statement without a value [message #3143 is a reply to message #3141] Tue, 09 May 2006 01:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
SqlSession has SetTrace method... (MySql, Oracle etc are derived from SqlSession).

Call it and U++ will start loging to [app].log file inside your .exe directory (or home in linux).

Mirek
Re: SQL Insert Statement without a value [message #3144 is a reply to message #3143] Tue, 09 May 2006 01:41 Go to previous message
Justin is currently offline  Justin
Messages: 57
Registered: March 2006
Location: Orange County California
Member
Awesome! That worked great. Thanks again Mirek.


Very Happy
Previous Topic: SqlExp and LIMIT
Next Topic: SQL, U++, and Escape Characters[SOLVED]
Goto Forum:
  


Current Time: Sat Apr 20 15:48:42 CEST 2024

Total time taken to generate the page: 0.01488 seconds