CWareIndia
asked on
My Database is not getting Update
Hi,
I am creating windows application using MS Access database, and dot net 3.5. I am trying to delete rows from database using dataset. My problem is that when i use adapter.update and dataset.commitchanges method ,row from datagrid deleted but my database remains the same, no row is deleting from database. Please help me.....................
I am creating windows application using MS Access database, and dot net 3.5. I am trying to delete rows from database using dataset. My problem is that when i use adapter.update and dataset.commitchanges method ,row from datagrid deleted but my database remains the same, no row is deleting from database. Please help me.....................
ASKER
My code is like that please tell me what is wrong in it.
DataGridView.Rows.RemoveAt (DataGridV iew.Curren tRow.Index ) OleDbCommandBuilder.GetUpd ateCommand ();
OleDbDataAdapter.Update(Da taTable);
DataGridView..Update();
DataTable.AcceptChanges();
My Datagrid update but changes are not reflecting in database.
DataGridView.Rows.RemoveAt
OleDbDataAdapter.Update(Da
DataGridView..Update();
DataTable.AcceptChanges();
My Datagrid update but changes are not reflecting in database.
GetDeleteCommand() - will delete specified rows
GetUpdateCommand() - will only alter values that are in existing fields.
GetInsertCommand() - will insert new rows.
You need to use GetDeleteCommand() in this instance.
GetUpdateCommand() - will only alter values that are in existing fields.
GetInsertCommand() - will insert new rows.
You need to use GetDeleteCommand() in this instance.
ASKER
GetDeleteCommand is also not working.
I am also not able to insert new record in database . When i connect to sql server and use same code, changes reflect in database. What could be the problem.
I am also not able to insert new record in database . When i connect to sql server and use same code, changes reflect in database. What could be the problem.
Can you show me the code your using, with the GetDeleteCommand implemented.
dataset.commitchanges method should be first then update.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
closed.
ASKER
i got my solution.
Open in new window