OleDbCommandBuilder insert query will not work? dataset to Access



I am trying to take a very strangely delimited text file and put it into
access. So far I was able to get the text file into a dataset and figured
from there I could get it into access. I am trying to use the code below but
the insert query just will not work. I am working with a blank access
database and I am able to get the table and the field names in the
database(with a primary key). I just cannot get the rest of the data. I get
an error that there is incorrect syntax in the insert query. Can someone
please help! I've been all over the site reading a buch of different things
and tried to just write inserts for each row but cannot get that to work
either.
Thank you!

DataSet result = new DataSet();
....get delimited file into dataset...

OleDbConnection DB = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=c:\\Conversions\\" + agencyid + "\\" + agencyid + ".mdb");

OleDbDataAdapter DataAdapter = new OleDbDataAdapter();
DataAdapter.SelectCommand = new OleDbCommand("SELECT * FROM " + TableName,
DB);
OleDbCommandBuilder CmdBuilder = new OleDbCommandBuilder(DataAdapter);
DB.Open();
DataAdapter.FillSchema(result, SchemaType.Source, TableName);
DataAdapter.InsertCommand = CmdBuilder.GetInsertCommand();
//I added the line above because the insert query did not show in the data
adapter.
//It now has: insert into tablename(fieldname1,fieldname2...) Values
(?,?,?...)

DataAdapter.Fill(result, TableName);
DataAdapter.Update(result, TableName);//Fails here on the insert query
DB.Close();

.



Relevant Pages

  • Re: Very slow query
    ... indexed for all the secondary tables, only the primary key is indexed). ... create a new blank database and immediately turn OFF the Name ... With 14 secondary tables or less, my query runs in 1 sec or less. ... in forms, base the form on the primary data table, and use combobox or ...
    (microsoft.public.access.queries)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: OT: SQL
    ... query processing. ... FROM Employees e, Employees m, Management mgt ... Manager and Employee Salaries. ... The scheme used does not model database files in general, ...
    (sci.logic)
  • Re: Query to merge
    ... Thanks for that insite - I am sure that the additional customers (that would ... simply build your query to give you all records from the one, ... Say it was a customer database. ... customers with the same primary key. ...
    (microsoft.public.access.queries)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... boxes from the form header, events, code, etc and ran the form query source ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would be ...
    (microsoft.public.access.conversion)

Loading