K
Katie
hi,
im having a problem commiting edits to my database. in the form load i
select the record to edit. i bind my text controls. then after i manually
edit my text in the text boxes i press the save button. the edits dont take.
when i click the save button i tell the dataset to accept changes from the
bound controls then call the update command. however, none of the changes
take. the bound text boxes do show the data for the row before editing so
they are bound but after i edit the text and click the save button no errors
and no changes occur. have i left something out?
any ideas?
---form load
dsDataSet = new DataSet();
daDataAdapter = new AsaDataAdapter("SELECT PK, Destination, Contain, Code
FROM items WHERE PK = " + mPKID.ToString() , conn);
daDataAdapter.Fill(dsDataSet, "items");
CboDestination.DataSource = dsDataSet.Tables["items"];
CboDestination.DisplayMember = "Destination";
//textBoxes - Simple Binding:
TxtContains.DataBindings.Add("Text",dsDataSet.Tables["items"],"Contain");
TxtBarcode.DataBindings.Add("Text",dsDataSet.Tables["items"],"Code");
---save button click
dsDataSet.Tables["items"].AcceptChanges();
daDataAdapter.UpdateCommand = new AsaCommand("UPDATE items SET PK = @PK,
Destination = @Destination, Contain = @Contain, Code = @Code, Timestamp =
@Timestamp WHERE PK = @PK", conn);
daDataAdapter.UpdateCommand.Parameters.Add("@PK",AsaDbType.Integer);
daDataAdapter.UpdateCommand.Parameters.Add("@Destination",AsaDbType.Char);
daDataAdapter.UpdateCommand.Parameters.Add("@Contain",AsaDbType.Float);
daDataAdapter.UpdateCommand.Parameters.Add("@Code",AsaDbType.Integer);
daDataAdapter.UpdateCommand.Parameters.Add("@TimeStamp",AsaDbType.TimeStamp)
;
daDataAdapter.Update(dsDataSet,"items");
im having a problem commiting edits to my database. in the form load i
select the record to edit. i bind my text controls. then after i manually
edit my text in the text boxes i press the save button. the edits dont take.
when i click the save button i tell the dataset to accept changes from the
bound controls then call the update command. however, none of the changes
take. the bound text boxes do show the data for the row before editing so
they are bound but after i edit the text and click the save button no errors
and no changes occur. have i left something out?
any ideas?
---form load
dsDataSet = new DataSet();
daDataAdapter = new AsaDataAdapter("SELECT PK, Destination, Contain, Code
FROM items WHERE PK = " + mPKID.ToString() , conn);
daDataAdapter.Fill(dsDataSet, "items");
CboDestination.DataSource = dsDataSet.Tables["items"];
CboDestination.DisplayMember = "Destination";
//textBoxes - Simple Binding:
TxtContains.DataBindings.Add("Text",dsDataSet.Tables["items"],"Contain");
TxtBarcode.DataBindings.Add("Text",dsDataSet.Tables["items"],"Code");
---save button click
dsDataSet.Tables["items"].AcceptChanges();
daDataAdapter.UpdateCommand = new AsaCommand("UPDATE items SET PK = @PK,
Destination = @Destination, Contain = @Contain, Code = @Code, Timestamp =
@Timestamp WHERE PK = @PK", conn);
daDataAdapter.UpdateCommand.Parameters.Add("@PK",AsaDbType.Integer);
daDataAdapter.UpdateCommand.Parameters.Add("@Destination",AsaDbType.Char);
daDataAdapter.UpdateCommand.Parameters.Add("@Contain",AsaDbType.Float);
daDataAdapter.UpdateCommand.Parameters.Add("@Code",AsaDbType.Integer);
daDataAdapter.UpdateCommand.Parameters.Add("@TimeStamp",AsaDbType.TimeStamp)
;
daDataAdapter.Update(dsDataSet,"items");