//查询信息sql语句
string sql = "select studentName,addres from student";
SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
//填充数据
adapter.Fill(ds, "student");
//绑定数据源
this.dataGridView1.DataSource = ds.Tables["student"];

 

 

注意:要写那个数据的在dataGridView空间中的datapropertyname绑定数据库中名称的数据列

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
猜你喜欢
  • 2021-12-29
  • 2021-11-23
  • 2022-01-05
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案