R
Rohit
I have a function here which takes a dataset as an argument and attempts to
update a SQL CE table with the data in the dataset. However it is not
working. When I check the database, there are no records in the table. Can
somebody help? Here is the code:
public void sync_db(DataSet d, string table_name, bool open)
{
if (open) con.Open();
SqlCeDataAdapter da = new SqlCeDataAdapter("SELECT * FROM " +
table_name, con);
SqlCeCommandBuilder cmdb = new SqlCeCommandBuilder(da);
da.InsertCommand = cmdb.GetInsertCommand();
da.DeleteCommand = cmdb.GetDeleteCommand();
da.UpdateCommand = cmdb.GetUpdateCommand();
da.Update(d);
if (open) con.Close();
}
update a SQL CE table with the data in the dataset. However it is not
working. When I check the database, there are no records in the table. Can
somebody help? Here is the code:
public void sync_db(DataSet d, string table_name, bool open)
{
if (open) con.Open();
SqlCeDataAdapter da = new SqlCeDataAdapter("SELECT * FROM " +
table_name, con);
SqlCeCommandBuilder cmdb = new SqlCeCommandBuilder(da);
da.InsertCommand = cmdb.GetInsertCommand();
da.DeleteCommand = cmdb.GetDeleteCommand();
da.UpdateCommand = cmdb.GetUpdateCommand();
da.Update(d);
if (open) con.Close();
}