标题:怎么把两个OleDbDataAdapter 合并到一个DataTable
取消只看楼主
沉默的痞子
Rank: 4
等 级:贵宾
威 望:12
帖 子:96
专家分:127
注 册:2015-10-7
结帖率:45%
 问题点数:0 回复次数:0 
怎么把两个OleDbDataAdapter 合并到一个DataTable
程序代码:
public OleDbDataAdapter FindForMdb(string mdbpath,string sql)
        {
            string connstr = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" + mdbpath;
            OleDbConnection conn = new OleDbConnection(connstr);
            return new OleDbDataAdapter(sql, conn);
        }
private void btnFind_Click(object sender, EventArgs e)
        {
            string sql = txtFind.Text;
            int dataCount = GetMDBCount();
            OleDbDataAdapter da;
            System.Data.DataTable dt = new System.Data.DataTable();
            for (int i = 1; i < dataCount; i++)
            {
                string path = System.Windows.Forms.Application.StartupPath + "\\data" + i.ToString() + ".mdb";
                da=FindForMdb(path, sql);
                da.Fill(dt);
            }
            dataGridView1.DataSource = dt;
        }


for循环这里会出现从多个文件从的查找结果 ,怎么显示到窗体上?
搜索更多相关主题的帖子: DataTable sql Data System string 
2020-06-22 18:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-502235-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014638 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved