Bound Data Saving Problem in Access 2003

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • babai28
    New Member
    • Jul 2008
    • 59

    Bound Data Saving Problem in Access 2003

    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:

    Code:
    da.Fill(ds,"Employee")
    where da is the OledbDataAdapte r and ds is the DataSet.

    Next is the simple code of binding:

    Code:
    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:

    Code:
    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?

    Regards
Working...