Need help adding a record to a table

Discussion in 'ASP.NET / ASP.NET Core' started by JoshuaLuke, Feb 16, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I've included a link to my cs file in rtf format and will highlite the pertinent functions with bold.

    Basically, I have the data in one table in an mdb and access it using oledb and load it into a DataSet. Then I use a command builder to create all the sql (and I have tried it manually as well) and everything works except for the insert command; delete, select, and update all work.

    The error I get is:

    System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
    at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
    at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
    at ssbg.sv.ButtonAdd_Click(Object sender, EventArgs e)

    I'm stumped, please help.

    Table details:

    ProductID (AutoNumber, also primary key)
    Title (text)
    Image (text)
    Visible (Yes/No)
    Price (double, currency)
    Monogram (double, currency)
    Shipping (double, currency)
    MonoMaxLines (integer)
    MonoMaxChars (integer)
    Description (memo)

    The field types are the Access definition, not the C# defs.

    Here is the link for the source code file:
    www.thyword.info/ssbg/db.rtf
     
  2. I had same problem.. I solved it by placeing the table name into the field names of the database.

    for a table named home and fields hi and bye:

    home_hi
    home_bye

    this is dependent on the method that you are using, will work if you are using the IDE but will not if hand coding

    Taylor
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page