Skip to content

SqlConnection.GetSchema cannot get procedure parameters with predefined metadata collection name #575

@mizulily

Description

@mizulily

Description

I tried to get parameters of sql server procedure, so I used GetSchema method as follow:
DataTable dt = connection.GetSchema(SqlClientMetaDataCollectionNames.Parameters);
Then I got an exception telling me the requested collection(Parameters) is not defined.
I am confused because I have already tried collections like Databases/Tables/Procedures/Columns and the collection name is predefined by SqlClientMetaDataCollectionNames class.

Configuration

I am using System.Data.SqlClient 4.8.1 from nuget with project configured as .Net Framework 4.7.

Other information

I reviewed some codes in System.Data and found that this collection name string is both 'ProcedureParameters' in OLEDB and ODBC connection.
So I tried to type 'ProcedureParameters' string straight as parameter of GetSchema and it worked.
DataTable dt = connection.GetSchema("ProcedureParameters");
I think it's a minor bug that you can fix it by updating string mapping in SqlClientMetaDataCollectionNames.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions