How to set unnamed SQL parameters in SqlCommand

If I add unnamed parameters to my SqlCommand , how to set parameter values ​​to SqlCommand?

I have no problem when I use named parameters where I can just do SqlCommand.Parameters.AddWithValue() .

Example:

 Select * from sometable where SomeValue=? and AnotherValue=? 
+4
source share
2 answers

With ADO.NET vs SQL Server, Can't You Use Those ? for parameters - you always need to use the @paramName approach.

? for unnamed parameters is ODBC "left", but not supported in ADO.NET when using SQL Server (not sure about MS-Access)

+4
source

Use ADODBConnection and ADODBCommand instead of SQL versions.

0
source

Source: https://habr.com/ru/post/1391617/


All Articles