SqlConnection thisConnection=new SqlConnection(@"Data Source=(local);Integrated Security=SSPI;"+"Initial Catalog=student");
thisConnection.Open(); 扔到da.fill(dt)上面一行
SqlCommand cmd2=new SqlCommand("select * from 档案 where 学号='"+this.textBox1.Text+"' and 姓名='"+this.textBox2.Text+"'",thisConnection);
SqlDataAdapter da=new SqlDataAdapter();
da.SelectCommand=cmd;
DataTable dt=new DataTable();
da.Fill(dt);
this.dataGrid1.DataSource=dt;