dapper 最简单操作示例

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

 

dapper 最简单操作示例

上一篇:SQL Server outer apply 和 cross apply


下一篇:python随机生成有效手机号码