PDA

Click to See Complete Forum and Search --> : VB .NET probs with ADO.NET


BillGleeson
Jul 29th, 2002, 09:37 AM
Hi,

I am having some problems using the .NET dataAdapter to insert/update a MSAccess2k database.

I add a new row to a dataset, then on calling the adapter update command, I get the following error

"No value given for one or more required parameters"

I've created the commandtext for the insert command:


"INSERT INTO Customer(DOB, Employer, Surname, HealthNotes, MemberNumber, Occupat" & _
"ion, PCityID, PhoneAH, PhoneBH, PhoneM, PPostCode, PStreetAddress, PSuburbID, Qu" & _
"estionID, RCityID, RPostCode, RStreetAddress, RSuburbID, Sex, GivenName) VALUES (?" & _
", ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"


Anybody have experience here ?
Thanks,
BG

Cander
Jul 29th, 2002, 09:47 AM
are you using that insert statement exactly as it is shown?

What is the deal with the question marks?

BillGleeson
Jul 29th, 2002, 10:12 AM
I am basing that insert statement on the one setup by the wizard.
All the examples I have seen use the question marks in the value clause of the SQL.

I am also creating the select clause myself (because I need data from multiple tables), not extracting the entire table into the dataset.

If I add parameters to the parameter collection for the insert command object, I dont get the error, but the database is not updated at all.

Only if I hard code the values in the SQL statement manually does it do anything. Surely that defeats the purpose of the .NET dataAdapter functions?
BG