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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM