Question Reading Text Files and Storing Values to Database

skaswani

Member
Joined
Oct 5, 2008
Messages
20
Programming Experience
Beginner
Dear All,

I am using VS 2010, and i want to read the Text File values and place them into variables

This is my code

VB.NET:
 Dim filename As String

        Me.OpenFileDialog1.FileName = Nothing
        If Me.OpenFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then
            Me.TextBox2.Text = Me.OpenFileDialog1.FileName
            filename = Me.TextBox2.Text
        End If

        Dim iofile As New StreamReader(filename)
        Dim ioline As String
        Dim emp_id, ename, sal

        ioline = iofile.ReadLine

        While Not ioline = ""

            Dim mysplit = Split(ioline, ",")

            emp_id = mysplit(0)
            ename = mysplit(1)
            sal = mysplit(2)


        End While


    End Sub

Pls help me i am unable to move pointer to next line
Thanks
 

Latest posts

Back
Top