How to generate bill number show in Textbox from database in c#
what change in this code to show billno in textbox
private int billno(string p)
{
Int32 Billno = 0;
cmd = new SqlCommand(p, con);
con.Open();
Billno = (Int32)cmd.ExecuteScalar();
con.Close();
return Billno;
// int billno = 0;
//billno = billno + 1;
//txt_billno.Text = billno.ToString(p);
}
{
Int32 Billno = 0;
cmd = new SqlCommand(p, con);
con.Open();
Billno = (Int32)cmd.ExecuteScalar();
con.Close();
return Billno;
// int billno = 0;
//billno = billno + 1;
//txt_billno.Text = billno.ToString(p);
}
int Billno = billno("Select ISNULL(Max(Billno+1),1) From MainBillForm");


Rafnas T PRank #280 · 8.8K reputationPosted Jun 30, 2017, 4:34 AM EDT
Amresh SRank #5,790 · 286 reputationPosted Jun 12, 2017, 1:01 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Jun 12, 2017, 1:03 AM EDT
{
Int32 Billno = 0;
cmd = new SqlCommand(p, con);
con.Open();
Billno = (Int32)cmd.ExecuteScalar();
con.Close();
return Billno;
// int billno = 0;
//billno = billno + 1;
//txt_billno.Text = billno.ToString(p);
}