I know that DataAdapters have performance issues, but are there any ways that could be faster? Currently, the DataAdapter.Fill method takes 5-6 seconds per 3000 entries, which is too slow for my application. If I delete the Fill line and just execute SQL (using SQLCE), it takes 20 milliseconds, so I assume the query is not a problem. I tried adding BeginLoadData to the datatable, but that does not make any difference to performance.
using (SqlCeConnection con = new SqlCeConnection(conString)) { con.Open(); using (SqlCeDataAdapter dAdapter= new SqlCeDataAdapter()) { using (SqlCeCommand com = new SqlCeCommand(query, con)) { com.Parameters.Add("uname", textBox1.Text); dAdapter.SelectCommand = com; dAdapter.SelectCommand.Connection = con; DataTable dTable = new DataTable(); dAdapter.Fill(dTable); dataGridView1.DataSource = dTable; } } }
Are there any better ways to populate a DataGridView or speed up the Fill method?
source share