1、现有两个Access数据库 db1.mdb,db2.mdb;
2、db1中有一个Student1表,db2中有一个Student2表;
3、
4、解决方法:
string strCon = "Provider=Microsoft.Jet.Oledb.4.0;data source=e:\\db1.mdb";
OleDbConnection con = new OleDbConnection(strCon);
string str = "select a.StudentID,a.StudentName,a.StudentSex,b.StudentPhone,b.StudentAddress from [;database=E:\\db2.mdb].Student2 as b,Student1 as a where a.StudentID=b.StudentID";
OleDbDataAdapter oda = new OleDbDataAdapter(str,con);
DataSet ds = new DataSet();
oda.Fill(ds);
this.dataGridView1.DataSource = ds.Tables[0];
5、实现效果