如何在SqlCommand中设置未命名的SQL参数
如果我将未命名的参数添加到我的SqlCommand
,如何在SqlCommand上设置参数值?
我使用命名参数时没有问题,我可以在其中执行SqlCommand.Parameters.AddWithValue()
。
例:
Select * from sometable where SomeValue=? and AnotherValue=?
使用ADO.NET对抗SQL Server,你不能使用那些?
对于参数 – 您始终必须使用@paramName
方法。
的?
对于未命名的参数是ODBC“遗留”但在使用SQL Server时不支持ADO.NET(不确定MS-Access)
使用ADODBConnection和ADODBCommand而不是SQL版本。