I want to get a list of result sets and columns that I can expect from SP. I was able to get the parameters, script ... but I don't know where to find the result sets and column names.
using Microsoft.SqlServer.Management.Smo;
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["mydbconn"].ConnectionString))
{
conn.Open();
Server sv = new Server(new Microsoft.SqlServer.Management.Common.ServerConnection(conn));
Database db = sv.Databases["mydb"];
foreach (StoredProcedure sp in db.StoredProcedures)
{
string[] columns = sp.??????
}
}
Is there any way to get the columns? I end up trying to write a code generator to automate my write data access objects. Thank you SO!
EDIT: "Another solution - if you can get the value of ScalarResult, you can convert it to something useful, from which you can get the columns" .: Any ideas how to do this?
source
share