A
Adam
Hello,
I have two tables, and when one table something change I have to modify
second table.
I don't know how update records in second table using SqlCeResultSet.
This code only adding a new rows to table2. So, how update records and add
new ?
sqlCmd.CommandText = "select [a],,[c],[d],[e] from [table1]";
sqlDataRead = sqlCmd.ExecuteReader();
ceCmd.CommandText = "table2";
ceCmd.CommandType = CommandType.TableDirect;
ceResSet = ceCmd.ExecuteResultSet(ResultSetOptions.Updatable);
ceRec = ceResSet.CreateRecord();
while (sqlDataRead.Read())
{
ceRec.SetValue(0, sqlDataRead[0]);
ceRec.SetValue(1, sqlDataRead[1]);
ceRec.SetValue(2, sqlDataRead[2]);
ceRec.SetValue(3, sqlDataRead[3]);
ceRec.SetValue(4, sqlDataRead[4]);
ceResSet.Insert(ceRec);
}
I have two tables, and when one table something change I have to modify
second table.
I don't know how update records in second table using SqlCeResultSet.
This code only adding a new rows to table2. So, how update records and add
new ?
sqlCmd.CommandText = "select [a],,[c],[d],[e] from [table1]";
sqlDataRead = sqlCmd.ExecuteReader();
ceCmd.CommandText = "table2";
ceCmd.CommandType = CommandType.TableDirect;
ceResSet = ceCmd.ExecuteResultSet(ResultSetOptions.Updatable);
ceRec = ceResSet.CreateRecord();
while (sqlDataRead.Read())
{
ceRec.SetValue(0, sqlDataRead[0]);
ceRec.SetValue(1, sqlDataRead[1]);
ceRec.SetValue(2, sqlDataRead[2]);
ceRec.SetValue(3, sqlDataRead[3]);
ceRec.SetValue(4, sqlDataRead[4]);
ceResSet.Insert(ceRec);
}