Hi :)
I have 3 DataGrids (and even more in the future) that supose to present data from a DataBase.
When i press on the main DG all the rest
are updated according to a cartein Code Index.
The problem is that its very slow and
i want to make it faster.
Im doing it like that:
1) When clicking on the main DG.
2) Code Index is taking from the DG.
3) a connection is created to a diffrent
table in the DataBase.
4)according to this Code Index, this
table is fitered using SQL string.
5)the dataSet is presented in a dataGrid.
Thos steps happend everytime i click
on a cell in the main DataGrid.
The problem is that this is slow
and i want to make it faster,
how can i do that ?
HERE IS THE CODE:
******************************************
dataGridView2.DataSource = null;
string CoString = @"Provider=PervasiveOLEDB;" + @"Data Source=Z:\index;";
string strSql2 = "SELECT description,street,number,settling FROM addresses WHERE code=" + code;
OleDbConnection con = new OleDbConnection(CoString);
con.Open();
// Addresses Table
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = new OleDbCommand(strSql2, con);
DataSet dataset2 = new DataSet();
adapter.Fill(dataset2, "addresses");
this.dataGridView2.DataSource = dataset2.Tables[0];
this.dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader;
this.dataGridView2.AutoResizeColumns();
//Close Connection
con.Close();
******************************************
Thanks.