Efficient way to load into dbase files (.dbf)

I am currently using OleDBCommand.ExecuteNonQuery (called repeatedly) to insert up to 350,000 rows into database files (* .dbf) at a time from the original DataTable. I reuse the OleDbCommand object and OleDbParameters to set the values ​​to be inserted each time the insert statement is called. Pasting 350,000 lines currently takes my program about 45 minutes.

Is there a more efficient way to do this? For Dbase (* .dbf) files, is there something similar to the Bulk Insert parameter used in SQL Server?

+5
source share
3 answers

.dbf .cdx , , Visual FoxPro, "dBase".

, VFP " " :

use (yourTable) SomeFile.txt csv

XLS, DELIMITED .

, VFP ExecScript(), , , , , PRG. VFP , , . VFP OleDb, , . script - ...

String script = "[USE YourTable SHARED] +chr(13)+chr(10)+ " 
    + "[APPEND FROM OtherTextSource TYPE CSV]";

,

YourConnection.ExecuteNonQuery( "ExecScript( " + script + " ) " );

, ( VFP) , , FINAL, , ... VFP .. : , , ...

String script = "[create cursor C_SomeTempArea( FinalCol1 c(20), "
              +    "FinalCol7 int, AnotherCol c(5) )] +chr(13)+chr(10)+ " 
              + "[APPEND FROM OtherTextSource TYPE CSV] +chr(13)+chr(10)+ " 
              + "[SELECT 0] +chr(13)+chr(10)+ " 
              + "[USE YourFinalTable] +chr(13)+chr(10)+ " 
              + "[Append from C_SomeTempArea]"

,

YourConnection.ExecuteNonQuery( "ExecScript( " + script + " ) " );

EDIT -

DBASE, , VFP OleDb Manager, , , , ...

+ "[USE YourFinalTable] +chr(13)+chr(10)+ " 
+ "[Append from C_SomeTempArea]"

int

   + "[COPY TO TEMPImport TYPE FOXPLUS]"

FOXPLUS , DBASE - OleDb. , dbase,

insert into (YourTable) select * from TempImport

, OleDb, VFP SCREAMS ...

+1

, SQL Server, SQL Server .

, , , . , Foxpro, ( ) SQL, , , . temp, , . , temp.

+1

All Articles