/// <summary>
/// 自动生成会员卡号
/// </summary>
void CardNumber()
{
string sql = string.Format("select top 1 cardId from cardInfo order by cardId desc");
DBHelper.cmd = new SqlCommand(sql, DBHelper.conn);
DBHelper.conn.Open();
int id = Convert.ToInt32(DBHelper.cmd.ExecuteScalar());
DBHelper.conn.Close();
string number = string.Format("023-{0:D3}", id + 1);
txtCardNumber.Text = number;
}
.net编程:自动生成会员卡号
时间: 2024-10-05 04:40:44