Code:
x = new OracleConnection("Data Source=cstr;Persist Security info=true;user id=dispatch;password=dispatch;unicode=true"); x.Open(); string p; string q; string st1 = textBox3.Text + "%"; y = new OracleCommand("select CUST_CODE from CUST_ADD where substr(CUST_NAME,0,1) like '" + st1 + "'", x); q = y.CommandText; z = y.ExecuteReader(); int r; y = new OracleCommand("select NVL(MAX(to_number(substr(CUST_CODE,2,3))),0)+1 from CUST_ADD where substr(CUST_CODE,0,1) like '" + st1 + "'", x); r = y.GetHashCode(); z = y.ExecuteReader(); if (z.HasRows) { if (z.Read()) { if (r <= 9) { p = q + "00" + r ; textBox1.Text = p; textBox1.Text = z[0].ToString(); } else if (r <= 99) { p = q + "0" + r; textBox1.Text = p; textBox1.Text = z[0].ToString(); } else { p = q + r; textBox1.Text = p; textBox1.Text = z[0].ToString(); } } } //z.Dispose(); y.Dispose(); x.Close();
PLZ SEE THIS CODE AND IF ANY ERROR THAN PLEASE HELP ME
Comment