static string dataConnection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; static IDbConnection connection = new MySqlConnection(dataConnection); public static string GetCode() { using (connection) { //查询 string code = connection.Query<string>($"SELECT orignal_code FROM `pack_code_oc` ").FirstOrDefault(); //删除 connection.Execute($"delete FROM `pack_code_oc` where orignal_code=‘{code}‘"); return code; } }
原文地址:https://www.cnblogs.com/KQNLL/p/9818454.html
时间: 2024-10-29 18:56:47