Sakyamuni
March 31st, 2008, 03:12 AM
Hi Everyone!
Im developing an application which uses dataGridView to (only) show the contents of tables from SQLite databases. Tables can grow to 1M+ records, so it is quite painful to wait for the long load times. Recently I read an article suggesting the use of virtual mode in dataGridView and cache the selects from the database. I can't seem to get it working, because I need to set the height of dataGridView vertical scrollbar, which is not permitted once the datasource is defined. I am thinking of using the sql LIMIT statement to select only partial data from tables and only show, what the user needs to see. Any advice on the issue ? Here is the code :
string sql = "SELECT rowid, length,sec,usec,sip,dip,protocol,sport,dport,packet_id FROM "+tableName;
using (SQLiteConnection conn = new SQLiteConnection("Data Source=" + PathToDatabase))
{
using (SQLiteDataAdapter da = new SQLiteDataAdapter(sql, conn))
{
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
}
Thanks for any advice!
Im developing an application which uses dataGridView to (only) show the contents of tables from SQLite databases. Tables can grow to 1M+ records, so it is quite painful to wait for the long load times. Recently I read an article suggesting the use of virtual mode in dataGridView and cache the selects from the database. I can't seem to get it working, because I need to set the height of dataGridView vertical scrollbar, which is not permitted once the datasource is defined. I am thinking of using the sql LIMIT statement to select only partial data from tables and only show, what the user needs to see. Any advice on the issue ? Here is the code :
string sql = "SELECT rowid, length,sec,usec,sip,dip,protocol,sport,dport,packet_id FROM "+tableName;
using (SQLiteConnection conn = new SQLiteConnection("Data Source=" + PathToDatabase))
{
using (SQLiteDataAdapter da = new SQLiteDataAdapter(sql, conn))
{
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
}
Thanks for any advice!