合并显示数据表的多个字段信息

//合并显示数据表的多个字段信息
 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);
}

你可能感兴趣的:(数据)