Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / July 2004

Tip: Looking for answers? Try searching our database.

Databinding based on Datarelation stops functioning

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian Korenaga - 21 Jul 2004 19:14 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.