+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

getting stored procedures schema


(Guest) #1

private static DataSet CreateDataSet()
{
DataSet ds = new System.Data.DataSet();
SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings[“ConnectionString”].ConnectionString);
conn.Open();

        object[] restrictions = new Object[] { null, null, null, "TABLE" };
        DataTable table = conn.GetSchema("Tables");

        //D: Durch alle Tabellen iterieren und in das DataSet aufnehmen
        //US: Iterate all tabels and add them to the DataSet
        foreach (DataRow dr in table.Rows)
        {
            string tableName = dr["Table_Name"].ToString();
            SqlDataAdapter dataAdapter;

            
            if (tableName == "Customers")
                dataAdapter = new SqlDataAdapter(new SqlCommand("SELECT * FROM [" + tableName + "]", conn));
            else
                dataAdapter = new SqlDataAdapter(new SqlCommand("SELECT * FROM [" + tableName + "]", conn));
            
            dataAdapter.FillSchema(ds, SchemaType.Source, tableName);
            dataAdapter.Fill(ds, tableName);
        }
        conn.Close();
        return (ds);
    }

I have written conn.GetSchema(“Tables”); for getting tables schema.My requirement is to GET stored procedures schema.so,please let me know how can i get stored procedures schema.


(Guest) #2

Hi Shangar,

thank you for your post.

You should be able to pass your stored procedure in the sql command, but you have to know the name of it. Maybe the following link helps to solve the problem:

link

Best][/url] regards,

Christian Rauchfuß
Technical Support
combit GmbH