EasyCFM.COM ColdFusion Forums / Coding Help! / Error Executing Database Query.

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Error Executing Database Query.

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

craigferrante
10-28-2007 @ 9:18 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Oct 2007

I added new feilds to my database and created the options on the admin page just like the origional code was. when i was finished and after checking my work this is my error.

The error occurred in D:\INETPUB\signcompaniesonline\admin\company_View.cfm: line 250
Called from D:\INETPUB\signcompaniesonline\admin\company_View.cfm: line 23
Called from D:\INETPUB\signcompaniesonline\admin\company_View.cfm: line 1
Called from D:\INETPUB\signcompaniesonline\admin\company_View.cfm: line 250
Called from D:\INETPUB\signcompaniesonline\admin\company_View.cfm: line 23
Called from D:\INETPUB\signcompaniesonline\admin\company_View.cfm: line 1

248 :       <CFELSE>
249 :     '
250 :  </cfif> WHERE companyID= #form.companyID#             </cfquery>       
251 :  
252 :  

SQL         update company SET unionShop = FALSE, archive = FALSE, WomenOwned = FALSE, InsAmt = 0, contractLic = ' , minority = FALSE, , BCU40 = FALSE, , BC40 = TRUE, , BC60 = FALSE, , BC80 = FALSE, , BC100 = FALSE, , Member ISA = FALSE, , Member USSC = FALSE, licenseNum = ' WHERE companyID= 2995
DATASOURCE        ziptest
VENDORERRORCODE        -3503
SQLSTATE        42000


If you have suggestions or can offer any guidence let me know.

Thanks Craig
866-388-9981



louissto56
10-28-2007 @ 9:36 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1149
Joined: Jan 2007

Umm ok. It all goes down hill from here

contractLic = ' ,

You have a single quote for some reason and you havent closed it, then you start using 2 commas for another strange reason. Fix those and it should work.

Louis

Notice-Board in NZ has now been released. Check it out at www.notice-board.co.nz !!

craigferrante
10-28-2007 @ 9:40 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Oct 2007

when you say single quote where are you speaking to in the code i understand the commas and am fixing that at this time.

Craig Ferrante 866-388-9981

louissto56
10-28-2007 @ 9:48 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1149
Joined: Jan 2007

contractLic = ' ,

' = single quote. If you are inserting a null then you will need to change it to

contractLic = ' ,

Notice-Board in NZ has now been released. Check it out at www.notice-board.co.nz !!

weathermanfsu
10-30-2007 @ 8:44 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 183
Joined: Apr 2004

Also depends on what type of database you are using and what the datatypes for the fields are.  I use SQL Server for the most part and I use bit fields for true / false fields.  In SQL, you use 0's and 1's for false / true so that could be it as well.

Also, understand that = ' is not setting a field to null, it is setting a field to "empty".  So if you query for null fields, these will not get returned because they are empty, not null.  If you want to set them to null then fieldname = Null

craigferrante
10-31-2007 @ 2:41 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Oct 2007

Yes it is a sql database but the origional web developer didnt use correct coding and its makes my life hard to find her errors and fix them. Since im new to doing this coding in cfm. I wouldnt mind finding someone to go thru and clean up her work and correct any error there might be. ( a few i know of) But i will look at = null and see if that works so far the other suggestion didnt help it still gave a error of the same line.

Craig Ferrante 866-388-9981

Scarecrow
10-31-2007 @ 6:32 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 109
Joined: Oct 2004

Post the query.

If you read the error message, you will see you have an ill formed sql query

SQL         update company SET unionShop = FALSE, archive = FALSE, WomenOwned = FALSE, InsAmt = 0, contractLic = ' , minority = FALSE, , BCU40 = FALSE, , BC40 = TRUE, , BC60 = FALSE, , BC80 = FALSE, , BC100 = FALSE, , Member ISA = FALSE, , Member USSC = FALSE, licenseNum = ' WHERE companyID= 2995

Ken

www.krcaldwell.com


Website Designed and Developed by Pablo Varando.