I have a T-SQL stored procedure in SQL Server, which queries multiple columns from multiple tables. For example, it may pull employee id from one table, employee name from another table, and employee department from another. In the database, each of those columns has a different length (e.g. employee id may be a varchar(20)
, employee name may be a varchar(30)
, and department may be a varchar(40)
).
How do I get the schema of the stored procedure results in .NET? In other words, in .NET, when I execute the stored procedure I want to know that 20 characters is the limit of the results first column, 30 characters is the limit of the results second column, and 40 is the limit of the results 3rd column.
Here is what I am currently doing, but its just returning a string, and tells me nothing about the database limits of the columns;
Dim dbCommandWrapper As DBCommandWrapper
dbCommandWrapper = GlobalDatabase.objDatabase.GetStoredProcCommandWrapper("My_StoredProcedure_Report")
If IsNothing(objGlobalDatabase.objTransaction) Then
Return GlobalDatabase.objDatabase.ExecuteDataSet(dbCommandWrapper).Tables(0).DefaultView()
Else
Return GlobalDatabase.objDatabase.ExecuteDataSet(dbCommandWrapper, objGlobalDatabase.objTransaction).Tables(0).DefaultView()
End If
Note I am using Enterprise Library. Answer is welcome in C# or VB (though the program is in vb).