private int billno(string p)
{
string Billno = "0";
cmd = new SqlCommand(p, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
Billno = reader[0].ToString();
}
reader.Close();
return Billno;
con.Close();
}
private void btn_Insert_Click(object sender, EventArgs e)
{
int Billno = billno("Select ISNULL(Max(Billno+1),1) From MainBillForm");
}