SqlConnection myConnection = new SqlConnection(SqlConn.Connection);
myConnection.Open();
SqlDataAdapter myCommand = new SqlDataAdapter();
myCommand.SelectCommand = new SqlCommand();
myCommand.SelectCommand.Connection = myConnection;
myCommand.SelectCommand.CommandText = "GradeList";
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
myCommand.Fill(ds);

if (ds != null && ds.Tables[0].Rows.Count > 0)
{
this.GradeName.DataSource = ds;
this.GradeName.DataTextField = "GradeName";
this.GradeName.DataValueField = "GradeName";
this.GradeName.DataBind();
this.GradeName.Items.Insert(0, new ListItem(GradeName, "0"));
this.GradeName.SelectedIndex = 0;
}
myConnection.Close();


浙公网安备 33010602011771号