关于gridcontrol 如何显示数据库的内容
//连接数据库string connectionString = Properties.Settings.Default.PJZBConnectionString;
//根据连接字符串创建SqlConnection实例
SqlConnection conn = new SqlConnection(connectionString);
conn.Open ();
//创建SqlCommand实例,并设置SQL语句和使用的连接实例
SqlCommand cmd = new SqlCommand();
// = "select t_zb.No,t_zb.Yjzb,t_zb.Ejzb,t_zb.Weight,t_zb.Unit,t_zb.Unit,t_zb.Flag,t_city.Zz,t_city.Kf,t_city.Ly,t_city.Pds,t_city.Ay,t_city.Hb,t_city.Xx,t_city.Jz,t_city.Py,t_city.Xc,t_city.Lh,t_city.Smx,t_city.Ny,t_city.Sq,t_city.Xy,t_city.Zk,t_city.Zmd,t_city.Jy from t_zb left join t_city on t_zb.No=t_city.No";
//SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd);
DataSet ds = ("select t_zb.No,t_zb.Yjzb,t_zb.Ejzb,t_zb.Weight,t_zb.Unit,t_zb.Unit,t_zb.Flag,t_city.Zz,t_city.Kf,t_city.Ly,t_city.Pds,t_city.Ay,t_city.Hb,t_city.Xx,t_city.Jz,t_city.Py,t_city.Xc,t_city.Lh,t_city.Smx,t_city.Ny,t_city.Sq,t_city.Xy,t_city.Zk,t_city.Zmd,t_city.Jy from t_zb left join t_city on t_zb.No=t_city.No"); ;
//dataAdapter.Fill(DS, );
//cmd.Connection = conn;
//GridControlMain.DataSource = dstlistZYXX.T_ListKSZYXX;
//this.gridControl1.DataSource = DS.Tables[ ];
this.gridControl1.DataSource = ds.Tables [0];
this.gridView1.PopulateColumns( );
conn.Close();
为什么不显示数据库的内容呢?急切的需要解答,谢谢