Home > Software engineering >  VB how to read large files and written to the database
VB how to read large files and written to the database

Time:02-10

Recent need to remove big TXT file to read each record, and inserted into the database, using normal reading method, run the program card died unexpectedly, excuse me each expert, how can you retrieve records,

Stuck program:

Private Sub Command4_Click ()

Open "d: \ i31\011 d. TXT" For Input As # 1

Dim As String b
Dim (s) As String

Set the cn=New ADODB. Connection
Strcon="Provider=SQLOLEDB. 1; Password=Password; Persist Security Info=True; User ID=AD; Initial Catalog=TJ; Data Source=22.39.128.153 "
Cn. The ConnectionString=strcon
Cn. Open

The Do While Not EOF (1)

The Line Input # 1, b

S=Split (b, "|")

Sql="insert into,,,"

Cn. The Execute (Sql)

Loop

The Close 1

MsgBox "the import is complete"


End Sub

CodePudding user response:

.
Doevents
Loop

Death is inevitable, the estimated amount of data with a progressbar according to schedule
  • Related