G
Guest
I have a dataset that contains 2 datatables. When I change a record and try
the update command it gives me this error...
Concurrency violation: the UpdateCommand affected 0 records. at
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping
tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
Here is the code:
SqlConnection con = new SqlConnection(strCon) ;
try
{
con.Open() ;
daAllSigns = new SqlDataAdapter(sqlAllSigns,con) ;
SqlCommandBuilder cb = new SqlCommandBuilder(daAllSigns) ;
daAllSigns.Fill(dsGrids,"AllSigns") ;
daQueSigns = new SqlDataAdapter(QueSigns,con) ;
daQueSigns.Fill(dsGrids,"QueSigns") ;
// Change record
dsGrids.Tables["AllSigns"].Rows[3]["Sign_Brand"] = "TEST BRAND" ;
dsGrids.Tables["AllSigns"].Rows[3]["Sign_SignDesc"] = "TEST DESC" ;
daAllSigns.Update(dsGrids.Tables["AllSigns"]) ;
catch(Exception exc)
{
Debug.WriteLine(exc.Message + " " + exc.StackTrace) ;
}
Does anyone know why this error could be coming up, the code seems pretty
straight forward to me....
the update command it gives me this error...
Concurrency violation: the UpdateCommand affected 0 records. at
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping
tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
Here is the code:
SqlConnection con = new SqlConnection(strCon) ;
try
{
con.Open() ;
daAllSigns = new SqlDataAdapter(sqlAllSigns,con) ;
SqlCommandBuilder cb = new SqlCommandBuilder(daAllSigns) ;
daAllSigns.Fill(dsGrids,"AllSigns") ;
daQueSigns = new SqlDataAdapter(QueSigns,con) ;
daQueSigns.Fill(dsGrids,"QueSigns") ;
// Change record
dsGrids.Tables["AllSigns"].Rows[3]["Sign_Brand"] = "TEST BRAND" ;
dsGrids.Tables["AllSigns"].Rows[3]["Sign_SignDesc"] = "TEST DESC" ;
daAllSigns.Update(dsGrids.Tables["AllSigns"]) ;
catch(Exception exc)
{
Debug.WriteLine(exc.Message + " " + exc.StackTrace) ;
}
Does anyone know why this error could be coming up, the code seems pretty
straight forward to me....