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

Shubham KumarRank #621 · 3.8K reputationPosted Feb 22, 2016, 6:41 PM EST
Chandu KumawatRank #1,449 · 1.1K reputationPosted Feb 22, 2016, 7:42 PM EST
Amit Kumar SinghRank #562 · 4.3K reputationPosted Feb 22, 2016, 9:38 PM EST
Anu VRank #1,282 · 1.3K reputationPosted Feb 22, 2016, 9:41 PM EST
Kev Patil19 reputationPosted Feb 23, 2016, 11:45 AM EST