Update records with SqlCeResultSet on SQL Mobile - HOW?

  • Thread starter Thread starter Adam
  • Start date Start date
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);
}
 
Dnia Fri, 20 Apr 2007 16:50:42 -0400, Ginny Caughey [MVP] napisa³(a):
Adam,

You need a separate SqlCeResultSet for each table.

Thanks, but first table is on MSSQL 2005 Express Edition and second table
is on Sql2005 mobile on mobile. I want copy data from sql2005EE to sql2005
mobile

And no, I don't want use rda. I just ask because I don't know how to do
copy and update data from MSSQL to SqlCe using SqlCeResultSet.
 
Adam,

Do you have more than one SQL Mobile table? If so you need to result sets.
If not, one will do. In any case, you could read data record by record from
SQL Express and copy it to SQL Mobile.
 
Back
Top