asp.net 调用sql存储过程

public DataSet Bkklist(Dush.common.booklist bkl)
        {
            SqlConnection stcon = new SqlConnection(Dush.dataaccess.conn.sqlconn);
            SqlCommand cmd = new SqlCommand("GetCategories", stcon); //存储过程名GetCategories
            cmd.CommandType = CommandType.StoredProcedure; //声明调用存储过程


            cmd.Parameters.Add(new SqlParameter("CategoriyId",SqlDbType.Int ));

            cmd.Parameters["CategoriyId"].Value = bkl.CategoriyId1;

            DataSet ds = new DataSet();
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            try
            {
                sda.Fill(ds);
                return ds;
            }
            catch (System.Exception E)
            {
                throw new System .Exception (E.Message);
            }
           

        }

你可能感兴趣的:(asp.net)