private void button2_Click(object sender, EventArgs e)
        {                                    System.Data.Odbc.OdbcConnection DBFconn = new System.Data.Odbc.OdbcConnection(@"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + textBox2.Text.Trim() + ";Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO");                DBFconn.Open();
                OdbcCommand DBFcmd = DBFconn.CreateCommand();                System.Data.Odbc.OdbcDataAdapter thisdbfdataadapter = new OdbcDataAdapter("select * from " + textBox2.Text.Trim(), DBFconn);
                OdbcCommandBuilder thisdbfbuilder = new OdbcCommandBuilder(thisdbfdataadapter);
                DataSet thisdbfdataset = new DataSet();                DataTable DBFdt = new DataTable();
                thisdbfdataadapter.Fill(DBFdt);
                DataRow[] xDBFRow;
                //以下是excel的操作                string table0 = textBox1.Text.Trim();
                string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source ="+table0+";Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1\"";
                OleDbConnection myConn = new OleDbConnection(strCon);
                string strCom = " SELECT * FROM [招生信息$] ";
                myConn.Open();                OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn);
                
                
                DataSet myDataSet = new DataSet();
                
                myCommand.Fill(myDataSet, "[招生信息$]");                string excelname,excelcode;                
                int t=myDataSet .Tables ["[招生信息$]"].Rows .Count ;
                for (int j = 2; j < t; j++)
                {
                    excelname = myDataSet.Tables["[招生信息$]"].Rows[j][0].ToString();
                    excelcode = myDataSet.Tables["[招生信息$]"].Rows[j][5].ToString();
                    myConn.Close();                    
                    //以下是数据比较
                    string DBFtable = textBox2.Text.Trim();                   
                    xDBFRow = DBFdt.Select("Xm='"+excelname+" '");                    if (xDBFRow != null)
                    {                        //如果有这学生,就把这条学生信息从excel中表复制过来dataGridView1
                    }                    else
                    {                        //如库中没有这学生,就把这条学生信息从excel表中复制到dataGridView2
                    }
                }             
        }