jp2msft
1/23/2008 1:55:00 AM
This is the hangup:
1. DataSet ds = new DataSet("EmpInfo");
2. da = new SqlDataAdapter(sqlCmd, conn);
3. da.Fill(m_dsCpApp, "EmployeeInfo");
4. dgEmpInfo.DataSource = m_dsCpApp.Tables["EmployeeInfo"].DefaultView;
Lines 2 & 3 both take a while.
"Cowboy (Gregory A. Beamer)" wrote:
> Unbinding is the opposite of binding. You have to remove each binding point.
>
> Before going too far, you have another issue you need to solve here and that
> is the database access time. Unless this is a file based database on an
> ancient computer with huge network lag, there has to be something you can do
> to speed up access time. 15000 records should be nothing, especially to a
> properly indexed database.
>
> I also have an issue with the databinding, as it should not cause that much
> of a problem, when done correctly. There are a couple of possibilities:
>
> 1. The book shows an inefficient method of data binding.
> 2. Your data access method is causing too many callbacks to get data. Rather
> than binding from data already gathered, it is binding some elements and
> then making a callback per row (ouch!).
>
> Without knowing more about your setup, I cannot make firm recommendations,
> but I would fully troubleshoot the problem prior to hacking at the
> application.
>
> On another note, this is the reason why some form of source control is a
> great idea. You can easily roll back to the last working version without
> having to hack things out. If your company will not allow you to implement
> real source control, save your app before you experiment so you can use copy
> and paste source control. It is not the wisest method, but it is better than
> nothing.
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> *************************************************
> | Think outside the box!
> |
> *************************************************
> "jp2msft" <jp2msft@discussions.microsoft.com> wrote in message
> news:0D0E0663-3A0A-48FF-942D-F64733449786@microsoft.com...
> > We have a database with one table of 15000 employees and 21 fields. (Yes,
> > it
> > needs to be restructured, but that isn't happening today).
> >
> > I have a DataGridView that is databound to the table. Whenever the
> > application starts, it takes about 5-10 seconds to populate this DataGrid
> > (depending on how congested our internal network is).
> >
> > I also have ComboBox controls for each of the individual fields in the
> > database. Before, I was filling these in programatically from data in the
> > TableAdapter for the DataGridView.
> >
> > While reading through a "How-To" book, I saw where I could have my
> > ComboBoxes also bound to the data. Hoping for increased effeciency, I data
> > bound each of my 21 ComboBoxes with a column from my table.
> >
> > Now, whenever I start my application, instead of taking 5-10 seconds to
> > populate the DataGridView and display the form, it now takes (5-10
> > seconds) *
> > (1 DataGridView + 21 ComboBoxes) to show the form.
> >
> > Ouch! I thought my application had crashed for an unknown reason!
> >
> > How do I "unbind" these controls now? There isn't anything in this
> > "How-To"
> > book on undoing the evils it started.
> >
> > Regards,
> > Joe
> >
> > "How-To" book: Microsoft Visual Basic 2005 "Step by Step"
>
>
>