Imports System.IO Imports MySql.Data.MySqlClient Public Class DeceasedUpdater Public sCon As MySqlConnection = New MySqlConnection Public sComand As MySqlDataAdapter = New MySqlDataAdapter Public ds As DataSet = New DataSet Dim table As New DataTable() Dim conn As MySqlConnection Dim cmd As MySqlCommand Dim dr As MySqlDataReader Dim connectionString As New MySqlConnection("server=10.10.0.6;user id=corpadmin;password=admincorp2024;database=caragavotersdb;port=3706") Private Sub conns() Try conn = New MySqlConnection("server=10.10.0.6;user id=corpadmin;password=admincorp2024;database=caragavotersdb;port=3706") conn.Open() Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 'Dim pathh 'Dim filname 'With FolderBrowserDialog1 ' If .ShowDialog() = Windows.Forms.DialogResult.OK Then ' pathh = .SelectedPath ' End If 'End With 'With OpenFileDialog1 ' If .ShowDialog() = Windows.Forms.DialogResult.OK Then ' filname = .SafeFileName ' End If 'End With 'TextBox3.Text = pathh + "\" + filname OpenFileDialog1.Title = "Please select a file" OpenFileDialog1.InitialDirectory = "C:\" OpenFileDialog1.Filter = "txt|*.txt" If OpenFileDialog1.ShowDialog() = DialogResult.OK Then 'Do things here, the path is stored in openFileDialog1.Filename 'If no files were selected, openFileDialog1.Filename is "" TextBox3.Text = OpenFileDialog1.FileName End If Try Dim lines() As String Dim vals() As String 'Dim myDirectoryInfo As DirectoryInfo = New DirectoryInfo(TextBox3.Text) ' get lines from the text file lines = File.ReadAllLines("" & TextBox3.Text & "") For i As Integer = 0 To lines.Length - 1 Step +1 ' lines vals = lines(i).ToString().Split("|") Dim row(vals.Length - 1) As String For j As Integer = 0 To vals.Length - 1 Step +1 ' columns row(j) = vals(j).Trim() Next j table.Rows.Add(row) Next i Catch ex As Exception MsgBox(ex.Message) End Try End Sub End Class