Results 1 to 3 of 3

Thread: VB .NET probs with ADO.NET

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2001
    Location
    Australia
    Posts
    36

    VB .NET probs with ADO.NET

    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:

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

    Anybody have experience here ?
    Thanks,
    BG

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    are you using that insert statement exactly as it is shown?

    What is the deal with the question marks?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2001
    Location
    Australia
    Posts
    36
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width