当前位置:   article > 正文

StringBuilder 拼接sql语句比较快

stringbuilder如何拼接sql

StringBuilder 拼接sql语句比较快


StringBuilder strBuilder = new StringBuilder();
strSql +=

"insert into tbDecRate(Ver,Prop_InsID,Year,Month,Rate,CreateUserID,CreateDate,ModifyUserID,ModifyDate)

values ('1','" + Prop_InsID + "','" + strYear + "','" + strMonth


+ "','" + strRate + "','System',GETDATE(),'System',GETDATE());";

strBuilder.AppendFormat("delete from tbDecRate where Prop_InsID='{0}'and year='{1}' and month='{2}';", Prop_InsID, strYear, strMonth);
strBuilder.AppendFormat("insert into tbDecRate(Ver,Prop_InsID,Year,Month,Rate,CreateUserID,CreateDate,ModifyUserID,ModifyDate)

values ('1','{0}','{1}','{2}','{3}','System',GETDATE(),'System',GETDATE());",Prop_InsID,strYear,strMonth,strRate);
有‘“+ +”’用AppendFormat

转载于:https://www.cnblogs.com/whl4835349/p/5670162.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/109560
推荐阅读
相关标签
  

闽ICP备14008679号