 |
| SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 20th, 2004, 08:33 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Access SQL Update Error
Hello,
From a C# program, using OleDb, I can do an insert into an Access db with no problem. But then when I go to update a row I've inserted I get this error:
"No value given for one or more required parameters."
Here are my insert and update statements:
"Insert Into Appt ( ApptID, ApptDate, StartTime, EndTime, CustID, CustName, EmpID, EmpName, Location, ApptNotes, Estimate) Values ( 'f5ce3d7a-be4b-4cfa-985b-a76e667b0982',#4/27/2004 12:00:00 AM#, 12, 14, '60000-1081872920', 'Lindsay:Test Job 1', '650000-1042121023', 'Duncan Fisher', \"\", \"\", 0)"
"Update Appt Set ApptID = 'f5ce3d7a-be4b-4cfa-985b-a76e667b0982', ApptDate = #4/27/2004 12:00:00 AM#, StartTime = 12, EndTime = 13, CustID = '60000-1081872920', CustName = 'Lindsay:Test Job 1', EmpID = '650000-1042121023', EmpName = 'Duncan Fisher', Location = \"\", AppNotes = \"\", Estimate = 0 Where ApptID = 'f5ce3d7a-be4b-4cfa-985b-a76e667b0982'"
And my Table:
Appt:
ApptID Text
AppDate Date/Time
StartTime Number
EndTime Number
CustID Text
CustName Text
EmpID Text
EmpName Text
Location Text
ApptNotes Text
Estimate Yes/No
DeviceID Text
DeviceApptID Text
The only required field is ApptID, and all of the Text fields (besides ApptID) allow zero length.
Any ideas/suggestions?
Thanks,
Lindsay
|
|

April 20th, 2004, 11:15 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
What is this meant to be: \"\"? There are no single quotes around it. That may be your problem...
|
|

April 20th, 2004, 12:21 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The "\"\ just sends an empty string.
|
|

April 20th, 2004, 01:52 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
No, it doesn't. What it does send is two double quotes.
Since you are already inside a string, the \"\" will be seen as two escape double quotes, so you end up with two few parameters.
Change it to '' and you'll be sending an empty string:
Code:
"Insert
Into Appt ( ApptID, ApptDate, StartTime, EndTime, CustID, CustName,
EmpID, EmpName, Location, ApptNotes, Estimate) Values ( 'f5ce3d7a-
be4b-4cfa-985b-a76e667b0982',#4/27/2004 12:00:00 AM#, 12, 14, '60000-
1081872920', 'Lindsay:Test Job 1', '650000-1042121023', 'Duncan
Fisher', '', '', 0)"
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Tarantula by Faithless (Track 8 from the album: Outrospective)
|
|

April 20th, 2004, 02:40 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Or send Null, but I'm guessing you are using an empty string for a particular purpose.
|
|
 |