0
Reply

Bound Data Saving Problem in Access 2003

Siddhartha Sarkar

Siddhartha Sarkar

Feb 27 2009 7:58 AM
2.2k
Hi All,
I have an Access Db Table Called Employees. The columns are as follows:
  1. EmployeeId (Autonumber) PK
  2. EmployeeName (Text)
  3. EmployeeRole (Test)
  4. DateOfJoining (DateTime) .

I am displaying the data in a simple DataGridView in a winform by using the following code:

da.Fill(ds,"Employee")

where da is the OledbDataAdapter and ds is the DataSet.
Next is the simple code of binding:

dgv.DataSource=ds.Tables["Employee"];

Here dgv is the dataGridView. I have used a command builder object to create the Insert/Update/Delete commands for the DataAdapter da.
However when I try to Update the Added record in the dataBase using:


da.Update(ds.Tables["Employee"]


it gives an error. I realise I need to define the insert command for the DataAdapter da, seperately. I tried searching in internet but could not locate something.
Can someone guide me to such page or suggest a solution for the problem?