• ThinkDev.Data


    在使用数据库的过程中,经常会碰到此类需求:生成语句:UPDATE dbo.UserInfo  SET UserName = UserName + '_old' WHERE UserID = 1
    此次更新,为该功能添加了支持:
    组件版本号:V1.0.0.2

    复制代码
    //首先定义实体类定义
       public class UserInfo
       {
           public int UserID { get; set; }
           public string UserName { get; set; }
           public string NickName { get; set; }
           public int Sex { get; set; }
           public string HeadPic { get; set; }
           public string Introduction { get; set; }
           public string Other { get   ; set; }
           public DateTime RegTime { get; set; }
       } 
       Public string GetSql()
       {
          string sql = SqlBuilder<UserInfo>.From(user, "dbo.UserInfo")
                   .Update()
                   .Set(u => u.UserName, u => u.UserName, "+", "_old")
                   .Where(u => u.UserID)
                   .And(u=>u.UserName, MatchType.In, "user1", "user2", "user3")
                   .GetSql();
       } 
       //或者
       Public string GetSql()
       {
          string sql = SqlBuilder.From("dbo.UserInfo")
                   .Update()
                   .Set("UserName", "UserName", "+", "_old")
                   .Where("UserID", 1)
                   .GetSql();
       }  
    复制代码
  • 相关阅读:
    nginx article
    学习历程
    GRPC
    学习记录
    JAVA知识点记录
    flag
    读的文章
    This usually happens because your environment has changed since running `npm install`.
    expandedRowKeys、expandedRowsChange、expand
    服务端高并发分布式架构演进之路
  • 原文地址:https://www.cnblogs.com/zhanglixina/p/7763332.html
Copyright © 2020-2023  润新知