Microsoft KB Archive/316146

= BUG: An error message occurs when you try to change the value of the child key column in the DataSet object =

Article ID: 316146

Article Last Modified on 3/9/2006

-

APPLIES TO


 * Microsoft .NET Framework 1.1 Service Pack 1
 * Microsoft ADO.NET 1.1

-



This article was previously published under Q316146



This article refers to the following Microsoft .NET Framework Class Library namespaces:
 * System.Data
 * System.Data.OleDb



SYMPTOMS
If you simulate a join query by using two DataTable objects (a DataRelation and an expression-based column that references the relation), you may receive the following error message if you try to change the value of the child key column in the DataSet object:

System.Data.VersionNotFoundException: There is no Proposed data to access.



RESOLUTION
There is no current workaround for this problem. Either do not use an expression-based column, or use the data in a read-only situation.



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



Steps to Reproduce the Behavior
 Create a new Visual Basic .NET console application.  At the top of the code window, add the following code: Imports System.Data.OleDb   Paste the following code into Module1: Sub Main Dim strConn, strSQL As String strConn = &quot;Provider=SQLOLEDB;Data Source=YourSQLServer;&quot; & _ &quot;Initial Catalog=Northwind;User ID=YourUserID;Password=YourPassword;&quot; Dim cn As New OleDbConnection(strConn) cn.Open ResetOrder(cn)

strSQL = &quot;SELECT OrderID, ProductID, Quantity, UnitPrice &quot; & _ &quot;FROM [Order Details] WHERE OrderID = 10503 &quot; & _ &quot;ORDER BY ProductID&quot; Dim daOrderDetails As New OleDbDataAdapter(strSQL, strConn) strSQL = &quot;SELECT ProductID, ProductName FROM Products&quot; Dim daProducts As New OleDbDataAdapter(strSQL, strConn)

Dim ds As New DataSet daProducts.FillSchema(ds, SchemaType.Source, &quot;Products&quot;) daOrderDetails.FillSchema(ds, SchemaType.Source, &quot;Order Details&quot;) ds.Relations.Add(&quot;ProductsOrderDetails&quot;, _     ds.Tables(&quot;Products&quot;).Columns(&quot;ProductID&quot;), _      ds.Tables(&quot;Order Details&quot;).Columns(&quot;ProductID&quot;)) ds.Tables(&quot;Order Details&quot;).Columns.Add(&quot;ProductName&quot;, GetType(String), _        &quot;Parent.ProductName&quot;) daProducts.Fill(ds, &quot;Products&quot;) daOrderDetails.Fill(ds, &quot;Order Details&quot;)

DisplayOrder(ds.Tables(&quot;Order Details&quot;)) Dim rowDetail, rowProduct As DataRow rowProduct = ds.Tables(&quot;Products&quot;).Rows.Find(1) rowDetail = ds.Tables(&quot;Order Details&quot;).Rows(0) Try ds.Tables(&quot;Order Details&quot;).Rows(0)(&quot;ProductID&quot;) = 1 Catch ex As Exception Console.WriteLine(ex.ToString) Console.ReadLine Exit Sub End Try

DisplayOrder(ds.Tables(&quot;Order Details&quot;))

Dim cbOrderDetails As New OleDbCommandBuilder(daOrderDetails) cbOrderDetails.QuotePrefix = &quot;[&quot; cbOrderDetails.QuoteSuffix = &quot;]&quot; daOrderDetails.Update(ds.Tables(&quot;Order Details&quot;))

ds.Tables(&quot;Order Details&quot;).Clear daOrderDetails.Fill(ds.Tables(&quot;Order Details&quot;)) DisplayOrder(ds.Tables(&quot;Order Details&quot;))

cn.Close End Sub

Private Sub DisplayOrder(ByVal tbl As DataTable) Dim row As DataRow For Each row In tbl.Rows Console.WriteLine(row(&quot;OrderID&quot;) & &quot; - &quot; & row(&quot;ProductName&quot;) & _       &quot; - &quot; & row(&quot;ProductID&quot;)) Next End Sub

Private Sub ResetOrder(ByVal cn As OleDbConnection) Dim strSQL As String strSQL = &quot;DELETE FROM [Order Details] WHERE OrderID = 10503;&quot; & _ &quot;INSERT INTO [Order Details] &quot; & _ &quot;   (OrderID, ProductID, Quantity, UnitPrice) &quot; & _ &quot;   VALUES (10503, 14, 70, 23.25);&quot; & _ &quot;INSERT INTO [Order Details] &quot; & _ &quot;   (OrderID, ProductID, Quantity, UnitPrice) &quot; & _ &quot;   VALUES (10503, 65, 20, 21.05)&quot; Dim cmd As OleDbCommand = cn.CreateCommand cmd.CommandText = strSQL cmd.ExecuteNonQuery End Sub  Modify the connection string (strConn) as necessary for your environment. Press F5 to run and to compile the application. You receive the error message in the &quot;Symptoms&quot; section.</li></ol>

Additional query words: VersionNotFoundException Version Exception System Data

Keywords: kberrmsg kbtshoot kbbug kbsystemdata kbpending KB316146

-

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

© Microsoft Corporation. All rights reserved.