private void NewIDGen()
{
long id = 0;
string str = "Select Max(ID) from T_MakeInvoice";
cbxID.Items.Clear();
con = new OleDbConnection(dbCon());
OleDbCommand cmd = new OleDbCommand(str, con);
con.Open();
OleDbDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
if (dr.IsDBNull(0) == false)
{
id = dr.GetInt32(0) + 1;
cbxID.Text = id.ToString();
}
else
cbxID.Text = "1";
}
dr.Close();
con.Close();
}
{
long id = 0;
string str = "Select Max(ID) from T_MakeInvoice";
cbxID.Items.Clear();
con = new OleDbConnection(dbCon());
OleDbCommand cmd = new OleDbCommand(str, con);
con.Open();
OleDbDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
if (dr.IsDBNull(0) == false)
{
id = dr.GetInt32(0) + 1;
cbxID.Text = id.ToString();
}
else
cbxID.Text = "1";
}
dr.Close();
con.Close();
}
No comments:
Post a Comment