StringBuilder 拼接sql语句比较快
16lz
2021-01-22
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
更多相关文章
- mysql常用命令/语句学习三
- 求一SQL语句(如何按某列的值分组且取出每组前几行的数据)
- 1)如何用语句来查看一个表内是否建了索引2)或用plsql查看一个表
- 高手是怎样炼成的:精妙SQL语句介绍
- 如何判断如下的sql语句是否被正确执行了
- 在线求助.Select语句包含ERP单据内表头与表身信息
- Spring 中jdbcTemplate 实现执行多条sql语句
- PB怎么将动态的sql语句以及数组。传给datawindow。
- 通过SQL语句访问远程数据库