Microsoft KB Archive/327375

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

Article ID: 327375

Article Last Modified on 10/11/2005

-

APPLIES TO


 * Microsoft .NET Framework Service Pack 1
 * 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:

http://support.microsoft.com/contactus/?ws=support

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.



Steps To Reproduce the Behavior
 In Visual Studio .NET, create a new .NET Windows application. Insert a SqlConnection that connects to a SQL Server Northwind sample database, and name the connection sqlConnection1. Insert two SqlDataAdapters, one to the Employees table, and the other to the Orders table, that are named sqlDataAdapter1 and sqlDataAdapter2 respectively. Generate a new Dataset that uses the Employees table and the Orders tables, and name it DataSet11. 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.</li> Insert a Windows Form DataGrid control that is named DataGrid1 in the form of the project.</li> Insert a Windows Form TextBox control that is named textBox1 in the form of the project.</li> Insert a button that is named Button1 in the form of the project.</li>  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(&quot;Text&quot;,this.dataSet11,&quot;Employees.EmployeesOrders.EmployeeID&quot;); } catch(SqlException ex) {   MessageBox.Show(ex.Message); } </li>  Add the SqlClient namespace with the following code: using System.Data.SqlClient; </li> Compile and run the application.</li> Click Button1, and notice that there is valid data in the DataGrid and in the TextBox.</li> Click Button1 a second time, and notice that there is no data in the TextBox, however, there is valid data in the DataGrid.</li></ol>

Keywords: kbbug kbfix kbsqlclient kbsystemdata kbqfe kbvs2002sp1sweep kbhotfixserver KB327375

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.