Dim cn As String = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database genk.mdb;") Dim SQLString As String = "SELECT * FROM Products" Dim OleDBConn1 As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(cn) Dim DataSet1 As New DataSet() Dim OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQLString, OleDBConn1) OleDBConn1.Open() OleDbDataAdapter1.Fill(DataSet1, "Products") DataGrid_Sort.DataSource = DataSet1.Tables("Products") Dim FLG as Boolean Dim EOA as Integer = B.lenth-1 Dim Temp as Byte Do FLG = False For I = 0 To EOA = -1 If B(I) > B(I+1) then Temp = B(I) B(I) = B(I +1) B( I +1) = Temp FLG = True End IF Next EOA = EOA -1 Loop while FLG
Hi,
As you can see I am trying to use bubble sort to sort to sort my product details from my MS Access database. The buuble sort code is there and the data grid view code is there which retrives the product details in my databse. How would i link the two together so that when the user clicks the button it uses the bubble sort code to sort and view the product deatils in order of firstname or lastname etc?