110,535
社区成员
发帖
与我相关
我的任务
分享
using (SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=MasterDB;Persist Security Info=True;User ID=sa"))
{
SqlDataAdapter da = new SqlDataAdapter("select * from GoodsMain", con);
DataSet ds = new DataSet();
da.Fill(ds);
this.dataGridView1.DataSource = ds;
this.dataGridView1.DataMember = ds.Tables[0].TableName;
}