PDA

View Full Version : Can't get dataset to update


jwite2003
04-15-2003, 08:03 PM
Hi...

I'm trying to modify and update an Oracle table in asp.net(C# codebehind & .Net Framework data provider for Oracle) using datasets. I have no problem filling the dataset and verifying that the data is present. But, nothing happens when I try to modify a datarow and update the dataset with the DataAdapter.Update(ds,src table) command.

I checked the rowstate of the DataRow before calling the DataAdapter.Update() but after attempting to modify it. The rowstate returned "unchanged".

Here's the code I'm using to try and update the DataRow.
private void TextBox2_TextChanged(object sender, System.EventArgs e)
{
dr = dsPlay1.PLAY.FindByFOO(1);
dr.BeginEdit();
dr["Bar"] = TextBox2.Text;
dr.EndEdit();
dr.AcceptChanges();
}
"Bar" is the column name of the row element that I'm hoping to alter. "Foo" is the primary key column and there is a DB row where foo=1.

Thanks for any insight,

miranda
04-17-2003, 06:16 AM
I am not familiar with C# but here it is in VB.Net


If DsPlay1.HasChanges() Then

Try

NameOfYourDataAdapter.Update(DsPlay1.NameOfYourDatabase)

Catch ex As Exception

'error handling code here

End Try