Microsoft KB Archive/821415

= FIX: &quot;System.Data.VersionNotFoundException: There Is No Current Data to Access&quot; Error Message When You Add a Row to DataTable =

Article ID: 821415

Article Last Modified on 10/25/2005

-

APPLIES TO


 * Microsoft ADO.NET 1.0
 * Microsoft ADO.NET 1.1

-





SYMPTOMS
When you try to add a row to a DataTable that has computed columns (with aggregate functions), the AddRow method may not be successful, and you may receive the following error message:

System.Data.VersionNotFoundException: There is no Current data to access. at System.Data.DataRow.GetCurrentRecordNo at System.Data.DataRow.GetRecordFromVersion(DataRowVersion version) at System.Data.AggregateNode.Eval(DataRow row, DataRowVersion version) at System.Data.DataExpression.Evaluate(DataRow row, DataRowVersion version) at System.Data.ColumnQueue.Evaluate(DataRow row, DataRowVersion version) at System.Data.ColumnQueue.Evaluate(DataRow row) at System.Data.DataColumnCollection.CalculateExpressions(DataRow row, DataRowAction action) at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 pos) at System.Data.DataTable.AddRow(DataRow row, Int32 proposedID) at System.Data.DataRowCollection.Add(Object[] values)



RESOLUTION
A supported fix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, 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/default.aspx?scid=fh;[LN;CNTACTMS]

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 usual 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 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 --  30-May-2003  22:22  1.0.0.0         1,663,144  Ndp1.1-kb821415-x86.exe 27-Jun-2003 15:01  1.1.4322.918    1,294,336  System.data.dll 03-Jul-2003 03:20  5.3.17.17         709,920  Windowsserver2003-kb821415-x86-enu.exe



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
You receive the error message that the &quot;Symptoms&quot; section describes when you follow these general steps:
 * 1) Create a DataTable with computed column based on aggregate function.
 * 2) Add rows to the DataTable and then call the AcceptChange method.
 * 3) Delete a row or rows from the table.
 * 4) Before calling the AcceptChange method, you add rows to the DataTable.

To reproduce this behavior, follow these specific steps:  Create a new Visual C# .NET Windows Application. To do this, follow these steps:  Start Microsoft Visual Studio .NET. On the File menu, point to New, and then click Project. Click Visual C# Projects under Project Types, and then click Windows Application under Templates. By default, Form1 is created. </li> Add a Button control to Form1.</li>  Add the following code to the button1_Click event handler: DataSet dSet = new DataSet; DataTable DTable = new DataTable(&quot;Test&quot;); DTable.Columns.Add(&quot;Val1&quot;, typeof(int)); DTable.Columns.Add(&quot;Total&quot;, typeof(int), &quot;SUM(Val1)&quot;); DTable.Rows.Add(new object[]{2}); DTable.AcceptChanges; DTable.Rows[0].Delete; try {   DTable.Rows.Add(new object[]{4}); } catch(Exception e1 ) {   System.Diagnostics.Debug.WriteLine(e1.ToString); } </li> On the Build menu, click Build Solution.</li> On the Debug menu, click Start.</li> In Form1, click button1. You may receive the error message that the &quot;Symptoms&quot; section describes.</li></ol>

Keywords: kberrmsg kbbug kbfix kbqfe kbtable kbhotfixserver KB821415

-

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

© Microsoft Corporation. All rights reserved.