Getting paged data into a DataGridView

flynn

Regular
Joined
Jul 28, 2005
Messages
59
I have an app that is currently getting data from a remote server, via the internet, and putting that data into a DataGridView. The data (a full client list) is being pulled down when the app is started and displayed. This solution has worked but now the customer is getting too many clients to bring down at one shot. The number of clients is starting to cause a significant delay at startup and I'm looking for a new method of getting the data.

The customer wants to keep the DataGridView functionality. I'd like to be able to put a textbox on the form so that on each keystroke I could call a stored proc that would return the first 20 clients that matched the current textbox entry. Then, as the customer would press PageDown or DownArrow, I would retrieve the next 20 that matched the textbox entry. Or if the customer pressed PageUp or UpArrow, I would retrieve the previous 20.

Does this design sound workable or am I way off in wanting to accomplish this from a remote server?

Can anyone point me toward a sample that would be a good starting point? I realize this will be a significant code change in this part of my application.

Current code layout:
Code:
SqlCommand sc = new SqlCommand(SP_SELECT_CLIENTS, conn);
sc.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(sc);
conn.Open();
da.Fill(dsClients, CLIENT_TABLE_NAME);
conn.Close();

// bind table to BindingSource and DataGridView
m_ClientBindingSource.DataSource = dsClients.Tables[CLIENT_TABLE_NAME];
dgvClient.DataSource = m_ClientBindingSource;


Thanks in advance,
flynn
 
Back
Top