Using VS .Net 2002 and Framework 1.0, all updates.
I've created a simple test project to illustrate my problem based on
the Pubs database. Using a windows form, I've added a few textboxes,
navigation buttons, dataset refresh button and a couple of datagrids
for debugging purposes. Using simple select statement data adapters
(no insert, update or delete), I populate Employee, Jobs and
Publishers tables in my dataset. I create datarelations between the
Employee and Jobs tables, Employee and Publishers tables
(enforceconstraints = false). I bind the datarelation textboxes as
follows (example):
this.textBox1.DataBindings.Add(new
System.Windows.Forms.Binding("Text", this.objEmployeeDS,
"Employee.rlJobs.job_desc"));
where rlJobs is the datarelation name.
When I run the program, textboxes are filled as expected. I can
navigate through all employees, textboxes are all displaying the
correct data.
The problem is when I refresh the dataset as follows:
TabcontrolDemo.employeeDS objTemp;
objTemp = new TabcontrolDemo.employeeDS();
objTemp.EnforceConstraints = false;
try
{
pubsConn.Open();
employeeDA.Fill(objTemp);
jobsDA.Fill(objTemp);
publishersDA.Fill(objTemp);
this.objEmployeeDS.Clear(); // Get rid of previous contents
this.objEmployeeDS.Merge(objTemp); // Merge to supposedly preserve
databinding
}
Textboxes that have no datarelations in the binding remain bound.
Textboxes that do have datarelations in the binding blank out. I know
that datarelation and overall binding is still good because
information displayed in the debugging datagrid:
// Bind to DataGrid to see its behavior on refresh
dataGrid1.DataSource = this.objEmployeeDS;
dataGrid1.DataMember = "Employee.rlJobs";
I also check bindingmember info before and after the refresh - the
information is the same.
Does anybody have any insight or solutions to offer? Either I am
missing something or it seems like something crucial is wrong with
databinding in .net.
Thanks,
Brian
Brian Korenaga - 28 Jul 2004 08:30 GMT
I'll answer my own question. Apparently there is a humungous bug in
the 1.0 Framework that causes this behavior. After I compiled (using
VS 2002 and 1.0 Framework) a release version and ran it on a computer
that only had the 1.1 Framework installed, the problem went away. Way
to go Microsoft! Another 8 hours of my life I won't get back. On to
deal with the tabcontrol shortcomings...
> Using VS .Net 2002 and Framework 1.0, all updates.
>
[quoted text clipped - 53 lines]
> Thanks,
> Brian