.net编程:自动生成会员卡号

   ///


        /// 自动生成会员卡号
        ///

        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;
        }

转载于:https://www.cnblogs.com/Miss-Lee/p/3888137.html

你可能感兴趣的:(.net编程:自动生成会员卡号)