M
MBadawi
I'm doing a task that is supposed to retrieve data from data base and
then displays it on a datagrid control, the user could modify the data
and then I try to update the data base with the modification.. I get
an SQLce exption " could not pars the query", knowing that this same
statement some times work!!
I cant find where is my error!! Here is a portion of the code which
the data base should be updated:
// This where the data base get updated
private void UpdatePB_Click(object sender, System.EventArgs e)
{
textEdit.Visible = false;
da.UpdateCommand = new SqlCeCommand("update plan_action_detail"
+" set pland_plan_visit = pland_plan_visit"
+" where phy_eng_name = @phy_eng_name"
+" and phy_speciality = @phy_speciality"
+" and pland_pot_code = @pland_pot_code", conn);
da.UpdateCommand.Parameters.Add("@pland_plan_visit",
SqlDbType.Decimal, 5, "pland_plan_visit");
da.UpdateCommand.Parameters.Add("@phy_eng_name", SqlDbType.NVarChar,
40, "phy_eng_name");
da.UpdateCommand.Parameters.Add("@phy_speciality",
SqlDbType.NVarChar, 5, "phy_speciality");
da.UpdateCommand.Parameters.Add("@pland_pot_code",
SqlDbType.NVarChar, 1, "pland_pot_code");
try
{
da.Update(DataGridDS.Tables[0]);
}
catch (SqlCeException exp)
{
MessageBox.Show(exp.Message);
}
}
then displays it on a datagrid control, the user could modify the data
and then I try to update the data base with the modification.. I get
an SQLce exption " could not pars the query", knowing that this same
statement some times work!!
I cant find where is my error!! Here is a portion of the code which
the data base should be updated:
// This where the data base get updated
private void UpdatePB_Click(object sender, System.EventArgs e)
{
textEdit.Visible = false;
da.UpdateCommand = new SqlCeCommand("update plan_action_detail"
+" set pland_plan_visit = pland_plan_visit"
+" where phy_eng_name = @phy_eng_name"
+" and phy_speciality = @phy_speciality"
+" and pland_pot_code = @pland_pot_code", conn);
da.UpdateCommand.Parameters.Add("@pland_plan_visit",
SqlDbType.Decimal, 5, "pland_plan_visit");
da.UpdateCommand.Parameters.Add("@phy_eng_name", SqlDbType.NVarChar,
40, "phy_eng_name");
da.UpdateCommand.Parameters.Add("@phy_speciality",
SqlDbType.NVarChar, 5, "phy_speciality");
da.UpdateCommand.Parameters.Add("@pland_pot_code",
SqlDbType.NVarChar, 1, "pland_pot_code");
try
{
da.Update(DataGridDS.Tables[0]);
}
catch (SqlCeException exp)
{
MessageBox.Show(exp.Message);
}
}