vs 2005使用帶參數的存儲過程
//指定存儲過程stp
SqlDataSource sds = new SqlDataSource(db_conn.myconn.ConnectionString , "usp_ Registration_select_val");
//聲明storedprocedure 命名類型
sds.SelectCommandType = SqlDataSourceCommandType.StoredProcedure ;
//參數
sds.SelectParameters.Add("UserName", "nina");
//將sqldatasource添加倒page
// page.Controls.Add(sds);
//生成一個dataview
DataView dv = new DataView();
dv = (DataView )sds.Select(DataSourceSelectArguments.Empty);
//指定gridview的datasourceid為sds.uniqueid
this.GridView1.DataSource = dv;
this.GridView1.DataBind();