Ivan;22 George;23 Nicole;24 . . .4. Data is inserted into database through SQL command INSERT INTO. In this way you do not need to open recordset, because you do not need to see the data.
Dim cn As New ADODB.Connection Dim cmd As New ADODB.Command Dim CurrentLine As String Dim SemicolonPosition As Integer Dim NameFromTXT As String Dim AgeFromTXT As Byte cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\TXT2ACCESS\SampleDatabase.mdb;Persist Security Info=False" cn.Open Set cmd.ActiveConnection = cn Open "c:\temp\TXT2ACCESS\SampleTextFile.txt" For Input As #1 Do While Not EOF(1) Line Input #1, CurrentLine SemicolonPosition = InStr(1, CurrentLine, ";", vbBinaryCompare) NameFromTXT = Trim(Left(CurrentLine, SemicolonPosition - 1)) AgeFromTXT = Val(Mid(CurrentLine, SemicolonPosition + 1)) cmd.CommandText = "INSERT INTO SampleTable(Name, Age) VALUES('" & NameFromTXT & "'," & CStr(AgeFromTXT) & ")" cmd.Execute Loop Close #1 Set cmd = Nothing cn.Close Set cn = Nothing7. Start the project and click on the button. After that open SampleDatabase and you will see inserted data into SampleTable.
Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000) br>
VB (.NET) - what other language do you need in the whole Universe?...