-
Notifications
You must be signed in to change notification settings - Fork 286
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
SqlConnection.GetSchema cannot get procedure parameters with predefined metadata collection name #575
Comments
/cc @cheenamalhotra |
HI @mizulily, I quickly checked the Microsoft.Data.SqlClient and found that there is a missing string for "ProcedureParameters" in SqlClientMetaDataCollectionNames.cs . Looks like it's the reason for this issue. Good catch 👍 Thanks, |
HI @karinazhou , |
@mizulily , I also test it with some old SQL Servers such as 2008, 2012, and 2016. All of them give me the same exception to this |
Closing as #580 got merged. |
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
The text was updated successfully, but these errors were encountered: