I am trying to insert a record into a database from each line in my text file. So far all I have accomplished is to insert 1 record (the same record) for each line in the file. So if I had 10 lines of different people I am getting some thing like this (see below) instead of the 10 different people.
Fast Eddie
Fast Eddie
Fast Eddie
Fast Eddie
Fast Eddie
Fast Eddie
Fast Eddie
Fast Eddie
Fast Eddie
Fast Eddie
The code I have is
Code:'***Subs Private Sub ReadFile() Dim oRead As StreamReader = _ File.OpenText("C:\member.txt") Do While oRead.Peek >= 0 Dim myLine As String = (oRead.ReadLine) Dim sAgent As String = myLine.Substring(0, 12) Dim sOffice As String = myLine.Substring(12, 12) Dim sName As String = myLine.Substring(24, 34) Dim sLName As String = myLine.Substring(58, 17) Dim sPhone As String = myLine.Substring(195, 12) Dim sExt As String = myLine.Substring(207, 4) Dim sFax As String = myLine.Substring(211, 12) Dim sEmail As String = myLine.Substring(207, 80) Dim sWeb As String = myLine.Substring(303, 80) Dim sDesig As String = myLine.Substring(386, 30) Dim sType As String = myLine.Substring(386, 30) Dim sLid As String = myLine.Substring(0, 12) InsertMember(sAgent, sOffice, sName, sLName, _ sPhone, sExt, sFax, sEmail, sWeb, sDesig, _ sType, sLid) Loop oRead.Close() End Sub




Reply With Quote