I have the following sql select code, where im trying to get value and i would like to ask user to continue if value is found or start new.
- var getJOB = txtJobNo.Text;
- try
- {
- MGMT_CON.Open();
- MGMT_COM = new SqlCommand("SELECT [job],[revno] FROM [MATRR] WHERE [job] = '" + getJOB + "'",
- MGMT_CON);
- var sqlRRev = MGMT_COM.ExecuteReader();
- if (sqlRRev.Read())
- {
- //ask user if want to continue
- //if wants to continue use the value from sql
- //else write something else into textbox
- //if reads get the revno from sql and convert into int
- var revno = Convert.ToInt32(sqlRRev.GetValue(1).ToString());
- //write mrr based on revno
- ddlRR.Text = "BBB-" + getJOB + "-" + (revno + 1);
- }
- else
- {
- ddlRR.Text = "BBB-" + getJOB + "-" + 1001;
- }
- MGMT_CON.Close();
- }
- catch (Exception e)
- {
- ClientScript.RegisterClientScriptBlock(GetType(), "alert", e.Message);
- }
please help.
Thankyou
Kev PatilPosted Feb 23, 2016, 4:45 PM
Anu VPosted Feb 23, 2016, 2:41 AM
Amit Kumar SinghPosted Feb 23, 2016, 2:38 AM
Chandu KumawatPosted Feb 23, 2016, 12:42 AM
Shubham KumarPosted Feb 22, 2016, 11:41 PM