设置命令文本清除SqlCommand上添加的参数?

时间:2016-06-01 09:01:47

标签: c# sql

如果我将参数添加到sqlcommand对象(addwithvalue)和后面我设置另一个命令文本,它将删除以前的参数? 示例(示例代码):

string sqltest = "some query col1=@param1 AND col2=@param2";
sqlcommandobject.Parameters.AddWithValue("@param1",sqldbtype.whatever).value=somevar;
sqlcommandobject.commandtext="other query but with also @param1";
//it will erease the previous addwithvalue?

0 个答案:

没有答案