Search code examples
sqloledbalter-tabledbfoledbcommand

How to reindex primary key table in OLEDB with VB.NET


I created my own index primary key with the .NET progran VB.NET. So how can my solution re-index the primary key and then load the database

Thanks

Already index

 Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

            Using cn As New OleDbConnection(connectionString)
                Using cmd As New OleDbCommand("ALTER TABLE RPD ADD CONSTRAINT idxMyTable PRIMARY KEY (PNM,NOD)", cn)

                    cn.Open()
                    cmd.ExecuteNonQuery()

                End Using
            End Using

            LoadData()



        End Sub

Solution

  • Here's a link!

                    Using cn As New OleDbConnection(connectionString)
                        Using cmd As New OleDbCommand("DROP INDEX idxMyTable ON RPD;", cn)
    
                            cn.Open()
                            cmd.ExecuteNonQuery()
    
                        End Using
                    End Using