Skip to content

SqlCommand DeriveParameters should not return database in type name for table valued parameters #28335

Description

@ssa3512

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.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions