数据集的刷新没有(即在内存中没有更新暂存的数据集内容)用update()方法 添加一句 da.Update(ds, "tb_ClientInfo");{其中da是 SqlDataAdapter da = new SqlDataAdapter("select * from tb_ClientInfo", sc);数据适配器的实例,sc是建立连接的实例}
using(OleDbConnection Con = new OleDbConnection("")) { string strSql = "select * from B"; OleDbCommand Cmd = new OleDbCommand(strSql, Con); OleDbDataAdapter da = new OleDbDataAdapter(Cmd); DataSet ds = new DataSet(); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; } 获取ACCESS中所有表名称 DataTable schemaTable = con.GetOleDbSchemaTable(OleDbSchemaGuid.Columns,null); con.Close();
{
DataSet ds=查询数据库,返回你需要的数据集;
datagridView.DataSource=ds;
datagridView.Bind();
}
添加一句 da.Update(ds, "tb_ClientInfo");{其中da是
SqlDataAdapter da = new SqlDataAdapter("select * from tb_ClientInfo", sc);数据适配器的实例,sc是建立连接的实例}
{
string strSql = "select * from B";
OleDbCommand Cmd = new OleDbCommand(strSql, Con);
OleDbDataAdapter da = new OleDbDataAdapter(Cmd);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
}
获取ACCESS中所有表名称
DataTable schemaTable = con.GetOleDbSchemaTable(OleDbSchemaGuid.Columns,null);
con.Close();
或者每次单击从access中获取一个表,宗之就是单击-->绑定下一张表。即可