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
111111