Hey,
I have structure and database.mdb with one table and columns with same name as in structure. What is the fastest way to fill structure with date from database? My database consists more than 200000 records, so it must be fastest way.
My structure:
My code to load data:Code:Public Structure Balas Public Prioritetas As Int16 Public Kodas As Int16 Public Balas As Double End Structure
Is faster way?Code:Public Sub LoadArrays() Dim Balas_() As Balas Dim n As Long Dim strDSN As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\studijos.mdb" Dim strSQL As String = "SELECT * FROM Studijos" Dim myConn As New OleDbConnection(strDSN) Dim myCmd As New OleDbCommand(strSQL, myConn) Dim datareader As OleDbDataReader = Nothing n = 0 myCmd.CommandText = "SELECT * FROM Balai" myConn.Open() datareader = myCmd.ExecuteReader() While datareader.Read() ReDim Preserve Balas_(n) Balas_(n).Balas = datareader("Balas") Balas_(n).Kodas = datareader("Kodas") Balas_(n).Prioritetas = datareader("Prioritetas") n = n + 1 DoEvents() End While myConn.Close() End Sub




Reply With Quote