Seems begineer but i really do not understand what these lines of code saying, since I'm kinda like newbie in datatable and dataview or such stuff!
DS.Tables("ActivityLookup").DefaultView.RowFilter = "[Description] =" & EncodeToText(oClass.moGen.Item("DESCRIPTION"))
If DS.Tables("ActivityLookup").DefaultView.Count = 0 Then
EncodeToText will encoed the text given from DESCRIP开发者_如何学PythonTION field in the database and convert it to string. So it is filtering it but only certain description fields, how ever by some strange reasons that second line is not working properly.
The first line is setting a filter on the table called "ActivityLookup"
in a DataSet
called DS
. When setting a filter using the RowFilter
property on the DefaultView
, you're telling the dataset to filter the contents of the DefaultView
according to some criteria. In your case, the filter is saying:
Show me all of the rows which have a description that matches the value of
oClass.moGen.Item("DESCRIPTION")
I don't know what that value is :)
The second line checks to see if any rows exist in the default view after the filter has been applied. In essence, it's saying "Are there any rows that have that description?".
Hope that helps.
精彩评论