First i'll explain my program a bit.
Im writing a Windows based app. In the main form, i have a DataGridView which binded to a DataSet. When i double-click the RowHeader, a detailed view of the selected customer will pop-up. So i can make changes to the customer details, and when i press save, it changes the value in the datagridview of the main form manually, like this customerGridView["custNameDataGridViewTextBoxColumn", customerGridView.CurrentRow.Index].Value = customerDlg.txtName.Text;
After that it'll fire the DataAdapter.Update() method. ShugahDA.Update(shugahCustomerDS);
I've tried many ways, using the updateCommand, parameter method, and also the Updatecommand with the hardcoded SQL string method. But seems like the record is still not being updated.
I started to think that by manually change data like customerGridView["custNameDataGridViewTextBoxColumn", customerGridView.CurrentRow.Index].Value = customerDlg.txtName.Text;
doesn't make the DataAdapter.Update() method to do anything (it thinks that the dataRow not changing) .
Can somebody help me with this?
Below is my codes for declaring UpdateCommand and the parameters
this.oleDbUpdateCommand1.CommandText = "UPDATE Customer\r\nSET CustName = ?\r\nWHERE (CustID = ?)" +
"";
this.oleDbUpdateCommand1.Connection = this.oleDbConnection1;
this.oleDbUpdateCommand1.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("CustName", System.Data.OleDb.OleDbType.VarChar, 255, "CustName"),
new System.Data.OleDb.OleDbParameter("Original_CustID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CustID", System.Data.DataRowVersion.Original, null)});
this.ShugahDA.UpdateCommand = this.oleDbUpdateCommand1;
Thanks in advance!