Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42225

Problem with DataView code in vb 2012

$
0
0
I am new to this coming from VB5.
I am getting the exception message "DataTable must be set prior to using DataView" on the first line of my code below.
What is the code I need to set the DataTable?? I am going thru this to find something in VB2012 similar to a FindNext in VB5.

Thanks for your help!!


Try
Dim custView = New DataView(_DEI_DatabaseDataSet.Tables("Customers File"), "", "[C-BuyLN]", DataViewRowState.CurrentRows)
Dim foundRows() As DataRowView = custView.FindRows(New Object() {"Rose"})

If foundRows.Length = 0 Then
Console.WriteLine("No match found.")
Else
Dim myDRV As DataRowView
For Each myDRV In foundRows
Console.WriteLine("{0}", myDRV("[C-BuyLN]").ToString())
Next
End If
Catch ex As Exception
MsgBox("Error in ""Find First"" : " + ex.Message)
End Try

Viewing all articles
Browse latest Browse all 42225

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>