未处理NullReferenceException异常
private void btnquery_Click(object sender, EventArgs e){
DBConnect();
sqlcon.Open();//这里引发了一个异常NullReferenceException,初学者不怎么会,求大神
SqlDataAdapter da = new SqlDataAdapter("Select ID as 学号," + "name as 姓名,class as 班级 from students WHERE ID " + "like '%" + cbID.Text + "%'", sqlcon);
DataSet ds = new DataSet();
da.Fill(ds, "tablename");
dataGridView1.DataSource = ds.Tables[0];
sqlcon.Close();
}