//合并显示数据表的多个字段信息
 string MyConnectionString="Data Source=(local);Integrated Security=SSPI; Initial Catalog = NorthWind";
 string MySQL = "Select CompanyName as 公司名称,Country+City+Address as 公司地址 From Customers";
 try
 {
      SqlDataAdapter MyAdapter=new SqlDataAdapter(MySQL,MyConnectionString);
      DataTable MyTable=new DataTable();
      MyAdapter.Fill(MyTable);
      this.dataGridView1.DataSource = MyTable;
 }
 catch(Exception ex)
 {
     MessageBox.Show(ex.Message,"信息提示",MessageBoxButtons.OK, MessageBoxIcon.Information);
}

相关文章:

  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-23
  • 2021-06-09
  • 2021-08-17
  • 2021-07-02
  • 2022-12-23
  • 2021-09-09
相关资源
相似解决方案