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
When using SqlCommandBuilder.DeriveParameters() which calls SqlCommand.DeriveParameters() the type name for the TVP in the derived parameters includes the database name which causes ExecuteNonQuery() to fail with the following exception:
System.Data.SqlClient.SqlException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Table-valued parameter 1 ("@DataTable"), row 0, column 0: Data type 0xF3 (user-defined table type) has a non-zero length database name specified. Database name is not allowed with a table-valued parameter, only schema name and type name are valid.
@Wraith2 I guess I am not sure what needs to be done to support it in a backward compatible way at this point. Additionally, I was unable to get a stable development environment up and running for corefx where I could run all the unit tests. If you have a fix please you can create a PR.
I've almost got this written but something caught my attention in the code you posted, there's no escaping. If you used a type name which required the [ ] because it had a space for example that should generate an invalid name shouldn't it? something like dbo.Type With Space when it should be dbo.[Type With Space].
I want to say that the names stored in r[colnames] are escaped before that point. I seem to remember seeing [] around the names when writing the workaround for this issue in my application.
When using
SqlCommandBuilder.DeriveParameters()
which callsSqlCommand.DeriveParameters()
the type name for the TVP in the derived parameters includes the database name which causesExecuteNonQuery()
to fail with the following exception:In depth write-up and repro project here: ssa3512/DotNet_GetStoredProcCommand_TVP_Repro
https://github.com/dotnet/corefx/blob/875c9842c94fdf3885a7cd28497d492bdd584543/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlCommand.cs#L2212-L2214
The text was updated successfully, but these errors were encountered: