-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing null values with odbc variables causing troubles #457
Comments
I can't repro the problem (will reference from test rig in a moment), but: have you tried using pseudo-positional parameters instead? (a dapper feature). Basically: instead of Can you provide a full repro that illustrates the problem, ideally including mention of the specific provider you are using? And: please do try with the |
I'm using SQL Anywhere 12. It seems that the error isn't about null values but about having more than 1 parameter. The ?name? trick did no difference. In the first test below I try setting variables in a single select which gives me an error stating: System.Data.Odbc.OdbcException: ERROR [08S01] [Sybase][ODBC Driver][SQL Anywhere]Communication error The second test uses multiple sets but then I get: System.Data.Odbc.OdbcException: ERROR [07002] [Sybase][ODBC Driver][SQL Anywhere]Not enough values for host variables Error description: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.sqlanywhere.12.0.1/saerrors/errm188.html Read about host variables only being available in one statement which explains why my latter test is not working:
Tests:
|
I just did som additional tests without dapper.
|
Wow, that seems pretty ... restrictive. If you're happy that dapper isn't to blame, do you want me to close this? or...? Note: in the case of integers and bools, you could probably abuse the literal injection support, via |
One thing I might try is to combine data into a string and then parse it in SQL, far from optimal but it should work. I'm closing this issue as it's not an issue with dapper. |
I get an exception from sybase anywhere when trying to execute a sql script with two parameters and one of them is null.
[Sybase][ODBC Driver][SQL Anywhere]Not enough values for host variables
ODBC doesn't support named parameters it only uses order of parameters and in sql it replaces ? in that order. Feels like dapper isn't passing parameters that is null.
Tried DBNull.Value instead with no luck. Also trired DynamicParameters.RemoveUnused = false.
The text was updated successfully, but these errors were encountered: