A
ALI-R
I am using the following code to update my database but it dosn't do the
update and it dosen't show any error:
SqlDataAdapter myDataAdapter=new SqlDataAdapter();
myDataAdapter.SelectCommand=new SqlCommand("select * from Alerts",conn);
DataSet alertDS = new DataSet();
myDataAdapter.FillSchema(alertDS,SchemaType.Source,"Alerts");
myDataAdapter.Fill(alertDS);
DataTable myTable = alertDS.Tables[0];
foreach(DataRow myDRow in myTable.Rows)
{
sb.Append((String)(myDRow["Message"]));
myDRow["Viewed"]=1;
}
myDataAdapter.Update(alertDS,"Alerts");
=====End of code=====================
if I remove this line from code :
myDataAdapter.FillSchema(alertDS,SchemaType.Source,"Alerts");
it gives me this error on the update on the adapter:
update requires a valid Update Command when passed DataRow collection with
modified rows
Is there somebody who can help me.
Thanks
update and it dosen't show any error:
SqlDataAdapter myDataAdapter=new SqlDataAdapter();
myDataAdapter.SelectCommand=new SqlCommand("select * from Alerts",conn);
DataSet alertDS = new DataSet();
myDataAdapter.FillSchema(alertDS,SchemaType.Source,"Alerts");
myDataAdapter.Fill(alertDS);
DataTable myTable = alertDS.Tables[0];
foreach(DataRow myDRow in myTable.Rows)
{
sb.Append((String)(myDRow["Message"]));
myDRow["Viewed"]=1;
}
myDataAdapter.Update(alertDS,"Alerts");
=====End of code=====================
if I remove this line from code :
myDataAdapter.FillSchema(alertDS,SchemaType.Source,"Alerts");
it gives me this error on the update on the adapter:
update requires a valid Update Command when passed DataRow collection with
modified rows
Is there somebody who can help me.
Thanks