QueryAsync not passing parameters in OdbcConnection and Sybase (SQL Anywhere)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Hi
I'm trying to execute a procedure to a Sybase database with the following code:
DynamicParameters parameters = new();
parameters.Add("TESTPARAM", userId, DbType.Int64, ParameterDirection.Input);
using (var db = new OdbcConnection(_configuration["ConnectionString"]))
{
result.AddRange(await db.QueryAsync<T>("TESTPROCEDURE", parameters, commandType: CommandType.StoredProcedure));
}
When I check the procedure in the dabase, I can see that the parameter is empty.
When executing as the following, the parameters are send correctly.
DynamicParameters parameters = new();
parameters.Add("TESTPARAM", userId, DbType.Int64, ParameterDirection.Input);
var query = "EXEC TESTPROCEDURE @TESTPARAM=?"
using (var db = new OdbcConnection(_configuration["ConnectionString"]))
{
result.AddRange(await db.QueryAsync<T>(query, parameters));
}
I also can't seem to work with named Parameters, I need to use the ? and add the parameters in the correct position.
Anything I'm doing wrong here? :)
Thank you
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the QueryAsync call using OdbcConnection and compare its stored-procedure invocation with the working EXEC TESTPROCEDURE @TESTPARAM=? example. Reproduce against Sybase SQL Anywhere and trace how parameters are bound; done means the stored-procedure form passes TESTPARAM correctly, or the limitation is clearly documented with a targeted test if the repository has one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100