sqlDbHelper中ExecuteReader的用法

    

           SqlConnection conn = new SqlConnection();

            conn.ConnectionString = SqlDbHelper.connectionString;
            SqlDataReader reader = SqlDbHelper.ExecuteReader("select * from t_class where specialty='" + this.specialtyType.SelectedValue + "'", conn);
            reader.Read();
            this.classType.DataSource = reader;
            this.classType.DataTextField = "name";
            this.classType.DataValueField = "id";
            this.classType.DataBind();
            reader.Close();

你可能感兴趣的:(sqlDbHelper中ExecuteReader的用法)