Imports MySql.Data.MySqlClient Public Class Duplicate_Scanner Public sCon As MySqlConnection = New MySqlConnection Public sComand As MySqlDataAdapter = New MySqlDataAdapter Public ds As DataSet = New DataSet Dim scrollVal As Integer Dim pagingAdapter As MySqlDataAdapter Dim pagingDS As DataSet Dim pagingDS2 As DataSet Private sRecord_Count As Integer 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 MessageBox.Show("Please Close to finish update 5 seconds & Open the program again. Or contact the programmer", "hhl no connection", MessageBoxButtons.OK, MessageBoxIcon.Error) End End Try End Sub ' DELETE t1 FROM full_data t1 'JOIN full_data_dup t2 ON t1.`name` = t2.`name` AND t1.`id` > t2.`id`; Private Sub Duplicate_Scanner_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'If conn.State = ConnectionState.Closed Then ' conn.Open() 'End If Label2.Text = "" End Sub Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick Try Dim i As Integer With DataGridView1 If e.RowIndex >= 0 Then i = .CurrentRow.Index TextBox1.Text = .Rows(i).Cells("name").Value.ToString 'names.Text = .Rows(i).Cells("names").Value.ToString 'Label1.Text = .Rows(i).Cells("names").Value.ToString 'purok.Text = .Rows(i).Cells("purok").Value.ToString 'barangay.Text = .Rows(i).Cells("barangay").Value.ToString 'bcc.Text = .Rows(i).Cells("pcc").Value.ToString 'contact.Text = .Rows(i).Cells("contact").Value.ToString 'precint.Text = .Rows(i).Cells("precint").Value.ToString End If End With ' name.Text = Decryptel(name.Text, 1) Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() connectionString.Close() connectionString.Dispose() MySqlConnection.ClearAllPools() End Try End Sub Private Sub a1() Call conns() Dim cmd1 As New MySqlCommand("Select full_data_entry.name,full_data_entry.barangay,full_data_entry.address from full_data_entry Inner join bcc on full_data_entry.name = names order by full_data_entry.name ASC", conn) Dim da As New MySqlDataAdapter Dim dt As New DataTable da.SelectCommand = cmd1 dt.Clear() da.Fill(dt) DataGridView1.DataSource = dt conn.Close() With DataGridView1 .Columns(0).HeaderCell.Value = "Name" .Columns(0).HeaderCell.Value = "Barangay" .Columns(0).HeaderCell.Value = "Purok" End With End Sub Private Sub a2() Call conns() Dim cmd1 As New MySqlCommand("Select full_data_entry.name,full_data_entry.barangay,full_data_entry.address from full_data_entry Inner join pco on full_data_entry.name = names order by full_data_entry.name ASC", conn) Dim da As New MySqlDataAdapter Dim dt As New DataTable da.SelectCommand = cmd1 dt.Clear() da.Fill(dt) DataGridView1.DataSource = dt conn.Close() With DataGridView1 .Columns(0).HeaderCell.Value = "Name" .Columns(0).HeaderCell.Value = "Barangay" .Columns(0).HeaderCell.Value = "Purok" End With End Sub Private Sub a3() Call conns() Dim cmd1 As New MySqlCommand("Select full_data_entry.name,full_data_entry.barangay,full_data_entry.address from full_data_entry Inner join hhl on full_data_entry.name = names order by full_data_entry.name ASC", conn) Dim da As New MySqlDataAdapter Dim dt As New DataTable da.SelectCommand = cmd1 dt.Clear() da.Fill(dt) DataGridView1.DataSource = dt conn.Close() With DataGridView1 .Columns(0).HeaderCell.Value = "Name" .Columns(0).HeaderCell.Value = "Barangay" .Columns(0).HeaderCell.Value = "Purok" End With End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged 'RECRUITES & BCC 'RECRUITES & PCC 'RECRUITES & HHL Try If ComboBox1.Text = "RECRUITES & BCC" Then Label2.Text = "from Data Entry" a1() ElseIf ComboBox1.Text = "RECRUITES & PCC" Then Label2.Text = "from Data Entry" a2() ElseIf ComboBox1.Text = "RECRUITES & HHL" Then Label2.Text = "from Data Entry" a3() Else End If conn.Close() conn.Dispose() connectionString.Close() connectionString.Dispose() MySqlConnection.ClearAllPools() Catch ex As Exception End Try End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try If TextBox1.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then Call conns() cmd = New MySqlCommand("Delete from full_data_entry where name = '" & TextBox1.Text & "'", conn) cmd.ExecuteNonQuery() MsgBox("Successfully Deleted", MsgBoxStyle.Information, "Deleted") End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() connectionString.Close() connectionString.Dispose() MySqlConnection.ClearAllPools() End Try If ComboBox1.Text = "RECRUITES & BCC" Then Label2.Text = "from Data Entry" a1() ElseIf ComboBox1.Text = "RECRUITES & PCC" Then Label2.Text = "from Data Entry" a2() ElseIf ComboBox1.Text = "RECRUITES & HHL" Then Label2.Text = "from Data Entry" a3() Else End If End Sub End Class