Question how to improve my code for loading more faster in datagrid view

mark trinidad

New member
Joined
Jul 1, 2016
Messages
1
Programming Experience
1-3
Dim db = New database
Dim dt As New DataTable
With db
.sqlStr = "Select itemprod_id as ProductID, item_name as BrandName, item_description as ItemDescreption, company_id as Company, quantity_stock as Stock, stock_alertcntr as alert, wprice as CompanyPrice, price as RetailPrice FROM items ORDER BY Item_name" 'query string
.sqlDa.SelectCommand = .sqlcm(.sqlStr, .connect) '
execute command
.sqlDa.Fill(.sqlDt) 'get results and store in sqldt
.close()
End With

dt = db.sqlDt

Return dt

my datagridview super slow showing 2000+ data from database
 
As I said at SO, there's no DataGridView in that code so this question, as asked, really has nothing to do with a DataGridView. I ask again, have you actually timed that code? Have you timed the query against the database directly? If not then you're just assuming that that's where the issue is and we all know what you do when you assume. Once you have DataTable populated, how are you actually loading the data into the grid?
 
Back
Top