You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that Dapper requires a different syntax for parameters in query depending on which type of connection you use.
I'm using a SQL Server database.
This is the code that works for a SqlConnection (using parameters with a @ sign):
var connectionString = @"Data Source=localhost;Initial Catalog=ComunicazioniGulliver;User ID=sa;Password=kubeswap.01";
var connection = new SqlConnection(connectionString);
connection.Open();
var parms = new DynamicParameters();
parms.Add("p0", 0);
parms.Add("p1", 20);
var res2 = connection.Query(
"SELECT [B04TDO0E].* FROM [dbo].[B04TDO0E] ORDER BY (SELECT 0) OFFSET @p0 ROWS FETCH NEXT @p1 ROWS ONLY",
parms);
This is the query that works with an ODBC connection (using parameters surrounded by question marks).
var connectionString = "DSN=ComunicazioniSqlServer;UID=sa;PWD=kubeswap.01";
var connection = new System.Data.Odbc.OdbcConnection(connectionString);
connection.Open();
var parms = new DynamicParameters();
parms.Add("p0", 0);
parms.Add("p1", 20);
var res2 = connection.Query(
[B04TDO0E].* FROM [dbo].[B04TDO0E] ORDER BY (SELECT 0) OFFSET ?p0? ROWS FETCH NEXT ?p1? ROWS ONLY",
parms);
SqlKata always compiles queries with the first syntax (@), but how should I manage odbc connections?
I would need a way to tell SqlKata to compile parameters using quotation marks.
I need to connect to this database using ODBC but my queries do not work this way.
The text was updated successfully, but these errors were encountered:
I noticed that Dapper requires a different syntax for parameters in query depending on which type of connection you use.
I'm using a SQL Server database.
This is the code that works for a SqlConnection (using parameters with a @ sign):
This is the query that works with an ODBC connection (using parameters surrounded by question marks).
SqlKata always compiles queries with the first syntax (@), but how should I manage odbc connections?
I would need a way to tell SqlKata to compile parameters using quotation marks.
I need to connect to this database using ODBC but my queries do not work this way.
The text was updated successfully, but these errors were encountered: