944,179 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 3656
  • C# RSS
Jul 29th, 2007
0

How to make it faster ? c# and dataBase

Expand Post »
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:

C# Syntax (Toggle Plain Text)
  1. ******************************************
  2. dataGridView2.DataSource = null;
  3.  
  4. string CoString = @"Provider=PervasiveOLEDB;" + @"Data Source=Z:\index;";
  5. string strSql2 = "SELECT description,street,number,settling FROM addresses WHERE code=" + code;
  6.  
  7. OleDbConnection con = new OleDbConnection(CoString);
  8. con.Open();
  9.  
  10.  
  11. // Addresses Table
  12. OleDbDataAdapter adapter = new OleDbDataAdapter();
  13. adapter.SelectCommand = new OleDbCommand(strSql2, con);
  14. DataSet dataset2 = new DataSet();
  15. adapter.Fill(dataset2, "addresses");
  16.  
  17. this.dataGridView2.DataSource = dataset2.Tables[0];
  18.  
  19. this.dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader;
  20. this.dataGridView2.AutoResizeColumns();
  21.  
  22. //Close Connection
  23. con.Close();
  24. ******************************************

Thanks.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
1qaz2wsx7 is offline Offline
17 posts
since Jul 2007
Aug 2nd, 2007
0

Re: How to make it faster ? c# and dataBase

Are you preforming the jobs one at a time? One way to make everything faster is to build a list first instead of doing them one at a time
Reputation Points: 70
Solved Threads: 4
Junior Poster
RwCC is offline Offline
173 posts
since Jan 2006
Dec 23rd, 2007
0

Re: How to make it faster ? c# and dataBase

I propose for u a solution, may be that get your application faster
use the tool negen.exe of the dotnet framework it creates a native image of your exe assembly in aspecified files and install them in the native image cache of the computer and that avoid the JIT compile your exe assembly each time u use the application
to do this
click on start -> Microsoft.Net Framework SDK v2.0 -> SDK command prompt
the tape
negen install exefilepath.exe
and then press enter
try this proposal
Reputation Points: 11
Solved Threads: 16
Junior Poster
Jugortha is offline Offline
172 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: add node to xmlfile
Next Thread in C# Forum Timeline: hello need help,i have an project.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC