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 ChoudharyPosted Mar 24, 2015, 7:51 PM
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");
Pankaj Kumar ChoudharyPosted Mar 25, 2015, 8:15 AM
Feroz KhanPosted Mar 25, 2015, 3:58 AM
both of solution is working.. thanks again..
Joginder BangerPosted Mar 24, 2015, 4:06 PM
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