-
Notifications
You must be signed in to change notification settings - Fork 71
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
Cannot use User Defined Table Types with the SqlCommandProvider #414
Comments
@daniellittledev could you check if using TableVarMapping parameter fixes the issue?
Here is sample in the tests: FSharp.Data.SqlClient/tests/SqlClient.Tests/TVPTests.fs Lines 154 to 157 in eb45a54
AFAIR, there are some technicalities as to why those TVP can't be inferred as it is done with other parameters, but you can still define commands using those, with extra/explicit declarations. |
Thanks, I had not seen that, I'll try it out. |
Hi there, I'm in the same situation that is @daniellittledev I've this query
When I run the code I get the following error: System.Data.SqlClient.SqlException (0x80131904): Must declare the scalar variable "@idProducts". I'm using the package FSharp.Data.SqlClient version 2.0.7. Which version of the package I have to install in order to use TableVarMapping? Also: How should I use TableVarMapping? Any example? I've been able to use User Defined Table Values sucessfully with a Stored Procedure but now I need to create a very simple query so I think using a SP is overkill. |
@vcrobe can you try adding |
@smoothdeveloper thank you for your quick response! I did it and now I get this error: The type provider 'FSharp.Data.SqlCommandProvider' reported an error: Must declare the scalar variable "@SQLCOMMANDPROVIDER_idProducts". |
Issue Summary
I'm attempting to use a
User Defined Table Type
to pass a list into a sql command. The type provider successfully infers the type of the User Defined Table and compiles correctly. However at runtime an error is thrown from the SqlClient indicating that a variable needs to be declared (even though it is declared).To Reproduce
Here is a sample Table Type:
Here is how you would use it, note that
DeleteRecordsCommandProvider.Identifiers
the type constructor is accessible off the provider.Error
However, when the following code is run the following error is thrown:
Expected behavior
I would expect this command to execute successfully.
What you can do
The text was updated successfully, but these errors were encountered: