示例#1
0
        private void button7_Click(object sender, EventArgs e)
        {
            string conn      = string.Empty;
            string file      = string.Empty;
            string tableName = "";
            int    i         = 0;

            //方法一,写文件再导
            using (BDBHelper dbHelper = new BDBHelper("DB2", conn))
            {
                i = dbHelper.LoadDataInLocalFile(tableName, file);
            }

            //方法二,转DataTable,再导入
            DataTable dt = new DataTable();

            using (BDBHelper dbHelper = new BDBHelper("DB2", conn))
            {
                //使用(适合数据量小,纯内存方式)
                i = dbHelper.LoadDataInDataTable(tableName, dt);
                //或者(适合数据量很大,超过10万的级别,内部会先写文件再导入)
                i = dbHelper.LoadDataInDataTableWithFile(tableName, dt);
            }
        }