please see below code every things is ok data updating but for example i want to update data where id = txtbox when i type the id in textbox which id is available in the table is showing data successfully no issue but which id is not available in the table yet showing update successfully
so please help me about this issue, how can i check id is available or not.. if not show id is not matching...
OracleCommand cmd = new OracleCommand("Update pa_em set TS_CRT_PW='05-Mar-15', NUMB_DYS_VLD='360', numb_fld_pw = '0', pw_acs_em = '1289464', where id = '" + emp_userid_txt.Text + "'", con);
OracleDataReader reader = cmd.ExecuteReader();
MessageBox.Show("Record Updated", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
while (reader.Read())
{
}
Loading

Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Mar 24, 2015, 3:51 PM EDT
if not data is updated in DB and it Return a Nonzero value if any data is updated in DB.
racleCommand cmd = new OracleCommand("Update pa_em set TS_CRT_PW='05-Mar-15', NUMB_DYS_VLD='360', numb_fld_pw = '0', pw_acs_em = '1289464', where id = '" + emp_userid_txt.Text + "'", con);
if(cmd.Executenonquery() >0)
{
messageBox.Show("Update Successfully ");
}
else
messageBox.Show("Updation failed");
Joginder BangerRank #360 · 7K reputationPosted Mar 24, 2015, 12:06 PM EDT
int Result=0;
OracleCommand cmd = new OracleCommand("Update pa_em set TS_CRT_PW='05-Mar-15', NUMB_DYS_VLD='360', numb_fld_pw = '0', pw_acs_em = '1289464', where id = '" + emp_userid_txt.Text + "'", con);
Int Result = cmd.ExecuteNonQuery();
if(Result>0)
{
MessageBox.Show("Record Updated", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
or you can try this link
Feroz Khan69 reputationPosted Mar 24, 2015, 11:58 PM EDT
both of solution is working.. thanks again..
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Mar 25, 2015, 4:15 AM EDT