var cont = cd.ExecuteScalar(); Var cout show Value = 9
// AutoNumber private void Autonumber() { string Query = "select MAX(ReceiptNo) from Project1"; SqlCommand cd = new SqlCommand(Query, con); try { con.Open(); var cont = cd.ExecuteScalar(); var count = (cont == DBNull.Value ? 1 : Convert.ToInt32(cont) + 1); txtRecpt.Text = count.ToString(); } finally { con.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)