I developed an application which is manipulating data from a database. When I run the app from my PC, or PCs near me (in my company, same server) it's working properly, but when someone from the same company but another server (another Country) is trying to do the same, he has tremendous LAG.
I am aware that the query it's a bit "to much":
SqlCommand command = new SqlCommand("SELECT * FROM dbo.Person", con)
More data -> more Lag
But I kinda need all the data from the database to populate a ListView then export to an Excel document.
Things I've tried:
I created a background worker that will execute this command and when the worker completes I populate the ListView with the data like this:
private void ViewAllWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
while (Oreader.Read())
{
ListViewItem item = new ListViewItem(Oreader["ID"].ToString());
item.SubItems.Add(Oreader["DecadeOfBirth"].ToString());
// etc
}
}
What would you do in this case? What could help reduce the lag? what is the right approach?