vishnu krishnan

vishnu krishnan

  • NA
  • 105
  • 252.8k

insert the data into db access , via asp. giving the error

Nov 14 2010 7:04 AM
code

strprovider = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\lastdb.mdb";
        OleDbConnection con = new OleDbConnection(strprovider);
        strcommand = "select * from lasttable";
        da = new OleDbDataAdapter(strcommand, con);
        DataRow mydr;
        DataSet mydataset = new DataSet();
        DataSet ds = new DataSet();
        da.Fill(mydataset);

        mydr = mydataset.Tables[0].NewRow();

        mydr["username"] = a;
        mydr["password"] = b;
        mydataset.Tables[0].Rows.Add(mydr);

        OleDbCommandBuilder ocb = new OleDbCommandBuilder(da);
        da.Update(mydataset);          <----(ERROR LINE 65)

        da.Fill(ds);

ERROR


System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
at Service.dbinsert(String a, String b) in e:\WebSite1\App_Code\Service.cs:line 65


Answers (1)