How to delete bill number auto Increment
Suppose I Have 50 Bill Total and I delete bill number 10 to 25. Now when creating new bill number
Bill Number 10 and then complete 25 bills
After create new bill 51 number
int Billno = billno("Select ISNULL(Max(Billno+1),1) From BillForm
private int billno(string p)
{
Int32 Billno = 0;
//s = Billno;
cmd = new SqlCommand(p, con);
int k;
con.Open();
if (txtbill.Text != "")
{
Billno = Convert.ToInt32(txtbill.Text);
k = Billno;
s = k;
k = (Int32)cmd.ExecuteScalar();
con.Close();
return Billno;
}
else
{
Billno = s;
Billno = (Int32)cmd.ExecuteScalar();
con.Close();
return Billno;
}
}