Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
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
 
Old April 20th, 2004, 08:33 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old April 20th, 2004, 11:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What is this meant to be: \"\"? There are no single quotes around it. That may be your problem...
 
Old April 20th, 2004, 12:21 PM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The "\"\ just sends an empty string.
 
Old April 20th, 2004, 01:52 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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)

 
Old April 20th, 2004, 02:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Or send Null, but I'm guessing you are using an empty string for a particular purpose.





Similar Threads
Thread Thread Starter Forum Replies Last Post
T-SQL statement causing error with insert/update saf SQL Language 0 September 7th, 2007 04:48 PM
SQL Update query (error message) Neal SQL Server 2000 1 August 3rd, 2007 08:57 PM
Error with SQL UPDATE mjw1901 Classic ASP Databases 8 December 4th, 2004 05:54 AM
Access and update linked SQL Server 2000 table Lizu Access 9 May 10th, 2004 12:42 PM
Allow SQL to update an Access database levinho Classic ASP Databases 7 November 11th, 2003 08:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.