【发布时间】:2013-08-03 02:46:58
【问题描述】:
我知道我们可以在 C# 代码中使用 SqlCommand.Parameters.AddWithValue("@xyz",xyz) 为查询 Select * from abc where xyz=@xyz 添加参数。但是是否可以更改查询的顶行参数,例如Select TOP @rows * from abc where xyz=@xyz,例如SqlCommand.Parameters.AddWithValue("@rows",32)?
因为每当我尝试它时,它都会向我显示这个异常:Incorrect syntax near '@rows'.
【问题讨论】:
-
不属于语法错误。
标签: c# .net sql-server parameters code-behind