在ASP.NET中如何给参数化SQL语句赋参数值

2024-12-22 21:44:21
推荐回答(1个)
回答1:

没看懂你说的意思
我一般用着两种方法
string sql = "update ClassType set className='"+className+"' where classId="+classId;

string sql = "insert into TuiGuang(tgName,tgUrl,orderNum)values(@tgName,@tgUrl,@orderNum)";
OleDbParameter[] parms = new OleDbParameter[]{
new OleDbParameter("@tgName",tg.TgName),
new OleDbParameter("@tgUrl",tg.TgUrl),
new OleDbParameter("@orderNum",tg.OrderNum),
};
int num = DBHelper.ExecuteCommand(sql, parms);