Suntower
Posts: 225
|
| Posted: 01/13/2008, 6:09 PM |
|
Hi,
I've got a custom update in a form that needs to update two tables. I am pretty sure I have the statement and parameters correct as the custom insert and deletes work fine. Here it is:
UPDATE SODETAILS SET ORDERQUANTITY = {ORDERQUANTITY}
WHERE RECORDID = {RECORDID}
UPDATE SPECS SET CHECKIMPRINTLINE_1 = {CHECK_IMPRINTLINE1},
CHECKIMPRINTLINE_2 = {CHECK_IMPRINTLINE2},
CHECKIMPRINTLINE_3 = {CHECK_IMPRINTLINE3},
CHECKIMPRINTLINE_4 = {CHECK_IMPRINTLINE4},
CHECKIMPRINTLINE_5 = {CHECK_IMPRINTLINE5},
CHECKIMPRINTLINE_6 = {CHECK_IMPRINTLINE6},
CHECKIMPRINTLINE_7 = {CHECK_IMPRINTLINE7},
CHECKIMPRINTLINE_8 = {CHECK_IMPRINTLINE8},
CHECKIMPRINTLINE_9 = {CHECK_IMPRINTLINE9},
CHECKIMPRINTLINE_10= {CHECK_IMPRINTLINE10}
WHERE SPECID = {SPECID}
But in the red error msg above the form fields I get...
'Line 1: Incorrect syntax near ','. (Microsoft OLE DB Provider for SQL Server)'
OK, so...
1. What am I doing wrong?
2. If it's not evident from the above, how do I see the true SQL expression being sent to the database server?
Thanks!
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
Edd
Posts: 547
|
| Posted: 01/13/2008, 9:27 PM |
|
Never seen 2 update statements in a custom SQL - you may have to separate them as if there is an error in the first update - you are never going to know about it. I would use a stored proc - but that is my preference.
And if there are any parameter strings e.g. {CHECK_IMPRINTLINE10} - you need to wrap them in quotes '{CHECK_IMPRINTLINE10}' .
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
datadoit
|
| Posted: 01/14/2008, 6:16 AM |
|
You have two SQL commands without a command break (the semi-colon).
|
|
|
 |
Suntower
Posts: 225
|
| Posted: 01/14/2008, 10:25 AM |
|
1. 2 statements works fine.
2. D'oh!!!!!!!!!!!!!!! The quote marks! I feel so STUPID!
3. The semi-colon. I feel so STUPID!
THANKS to you both for the quick replies!
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
|