VersionNotFoundException クラス
アセンブリ: System.Data (system.data.dll 内)


1 個の DataColumn オブジェクトと 10 個の DataRow オブジェクトを使用して、DataTable を作成する例を次に示します。DataRow を削除した後、削除した行の現在のバージョンを返そうとすると、VersionNotFoundException 例外がスローされます。
Private Sub DemonstrateVersionNotFoundException() ' Create a DataTable with one column. Dim table As New DataTable("NewTable") Dim column As New DataColumn("NewColumn") table.Columns.Add(column) Dim newRow As DataRow Dim i As Integer For i = 0 To 9 newRow = table.NewRow() newRow("NewColumn") = i table.Rows.Add(newRow) Next i table.AcceptChanges() Try Console.WriteLine("Trying...") Dim removedRow As DataRow = table.Rows(9) removedRow.Delete() removedRow.AcceptChanges() ' Try to get the Current row version. Console.WriteLine(removedRow(0, DataRowVersion.Current)) Catch e As System.Data.VersionNotFoundException Console.WriteLine("Current version of row not found.") End Try End Sub
private void DemonstrateVersionNotFoundException() { // Create a DataTable with one column. DataTable table = new DataTable("NewTable"); DataColumn column = new DataColumn("NewColumn"); table.Columns.Add(column); DataRow newRow; for(int i = 0;i <10;i++) { newRow = table.NewRow(); newRow["NewColumn"] = i; table.Rows.Add(newRow); } table.AcceptChanges(); try { Console.WriteLine("Trying..."); DataRow removedRow = table.Rows[9]; removedRow.Delete(); removedRow.AcceptChanges(); // Try to get the Current row version. Console.WriteLine(removedRow[0,DataRowVersion.Current]); } catch(System.Data.VersionNotFoundException) { Console.WriteLine("Current version of row not found."); } }

System.Exception
System.SystemException
System.Data.DataException
System.Data.VersionNotFoundException


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- VersionNotFoundException クラスのページへのリンク