日期:2014-05-17 浏览次数:21007 次
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=KPOL;Persist Security Info=True;User ID=sa;Password=123456");
SqlDataAdapter adp = new SqlDataAdapter("select * from DAT_FireTicketInfo ", conn);
DataSet ds2 = new DataSet();
adp.Fill(ds2);
dataGridView1.DataSource = myBindingSource;//将BindingSource绑定到GridView
myBindingSource.DataSource = ds2.Tables[0];
conn.Close();