FIX: A Winform control is not populated with data when you call the DataSet.Clear method before you reload the DataSet (327375)



The information in this article applies to:

  • Microsoft .NET Framework 1.0 SP2
  • Microsoft Visual Studio .NET (2002), Professional Edition

This article was previously published under Q327375

SYMPTOMS

You have a Visual Studio .NET application with a DataSet that contains a parent-child relationship. The child record is bound to a Winform control. When you call the DataSet.Clear method before you reload data in the Winform control, the control is not populated with data.

RESOLUTION

A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version       Size           File name
------------------------------------------------------------------------
08/08/2002 4:16:47 PM 1.0.3705.308  1175552	  System.Data.dll	        
08/08/2002 1:51:57 PM 1.0.3705.308  1986560	  System.Windows.Forms.dll	
08/08/2002 1:52:45 PM 1.0.3705.308    57344	  System.Windows.Forms.tlb	
                                      16616	  System.Windows.Forms.ldo	


				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps To Reproduce the Behavior

  1. In Visual Studio .NET, create a new .NET Windows application.
  2. Insert a SqlConnection that connects to a SQL Server Northwind sample database, and name the connection sqlConnection1.
  3. Insert two SqlDataAdapters, one to the Employees table, and the other to the Orders table, that are named sqlDataAdapter1 and sqlDataAdapter2 respectively.
  4. Generate a new Dataset that uses the Employees table and the Orders tables, and name it DataSet11.
  5. Open DataSet1.xsd that is generated, and add a relationship between the Employees table and the Orders table. To do this, drag the EmployeeID field from the Employees table to the Orders table. This creates a relationship in which the EmployeeID primary key in the Employees table is the foreign key in the Orders table.
  6. Insert a Windows Form DataGrid control that is named DataGrid1 in the form of the project.
  7. Insert a Windows Form TextBox control that is named textBox1 in the form of the project.
  8. Insert a button that is named Button1 in the form of the project.
  9. Double-click Button1, and then add the following code to the Click event handler of the button:
    try
    {
    	this.dataSet11.Clear();
    	this.sqlDataAdapter1.Fill(this.dataSet11);
    	this.sqlDataAdapter2.Fill(this.dataSet11);
    	this.dataGrid1.DataSource = this.dataSet11;
    	this.textBox1.DataBindings.Clear();
    	this.textBox1.DataBindings.Add("Text",this.dataSet11,"Employees.EmployeesOrders.EmployeeID");
    }
    catch(SqlException ex)
    {
    	MessageBox.Show(ex.Message);
    }
    
  10. Add the SqlClient namespace with the following code:
    using System.Data.SqlClient;
  11. Compile and run the application.
  12. Click Button1, and notice that there is valid data in the DataGrid and in the TextBox.
  13. Click Button1 a second time, and notice that there is no data in the TextBox, however, there is valid data in the DataGrid.

Modification Type:MinorLast Reviewed:10/11/2005
Keywords:kbHotfixServer kbQFE kbvs2002sp1sweep kbSystemData kbSqlClient kbbug kbfix KB327375 kbAudDeveloper kbAudEndUser kbAudITPRO kbAudOEM