コード例 #1
0
        public DataSet retrieve_stored_procedures_for_table(string table_name)
        {
            string         strSQL;
            SqlCommand     cmdSQL = new SqlCommand();
            DataSet        ds;
            SqlDataAdapter adAdapter;

            //set up the data adapter/data set
            adAdapter = new SqlDataAdapter();
            ds        = new DataSet();

            //set up the query
            strSQL = "";
            strSQL = strSQL + "SELECT [name] ";
            strSQL = strSQL + "FROM sysobjects  ";
            strSQL = strSQL + "WHERE type = 'P' ";
            strSQL = strSQL + "AND category = 0 ";
            strSQL = strSQL + "AND [name] like '" + CommonLib.sqlclean(table_name) + "_SP_%' ";
            strSQL = strSQL + "AND [name] not in ('" + CommonLib.sqlclean(table_name.ToUpper()) + "_SP_SAVE', '" + CommonLib.sqlclean(table_name.ToUpper()) + "_SP_RETRIEVE', '" + CommonLib.sqlclean(table_name.ToUpper()) + "_SP_DELETE') ";

            //Set up the command object
            cmdSQL.CommandText = strSQL;
            cmdSQL.Connection  = connConnectionClass;

            //Fill The dataset
            adAdapter.SelectCommand = cmdSQL;
            adAdapter.Fill(ds, "table");

            return(ds);
        }
コード例 #2
0
        public DataSet retrieve_params_for_sp(string stored_proc)
        {
            string         strSQL;
            SqlCommand     cmdSQL = new SqlCommand();
            DataSet        ds;
            SqlDataAdapter adAdapter;

            //set up the data adapter/data set
            adAdapter = new SqlDataAdapter();
            ds        = new DataSet();

            //set up the query
            strSQL = "";
            strSQL = strSQL + "SELECT name, type_name(user_type_id) as type ";
            strSQL = strSQL + "FROM sys.parameters  ";
            strSQL = strSQL + "WHERE object_id = object_id('" + CommonLib.sqlclean(stored_proc) + "') ";

            //Set up the command object
            cmdSQL.CommandText = strSQL;
            cmdSQL.Connection  = connConnectionClass;

            //Fill The dataset
            adAdapter.SelectCommand = cmdSQL;
            adAdapter.Fill(ds, "table");

            return(ds);
        }