Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with datacolumn
Message
From
20/12/2006 16:50:37
 
 
To
20/12/2006 16:44:56
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01179364
Message ID:
01179369
Views:
10
>How I make to I know if a datacolumn exist in datatable

Here are various possibilities:
        ' Return True if a field exists in a table
        ' expO1 Dataset
        ' expC1 Table
        ' expC2 Field
        Public Function FieldExist(ByVal toDataSet As DataSet, ByVal tcTable As String, _
         ByVal tcField As String) As Boolean
            Dim loColumn As DataColumnCollection
            loColumn = GetColumn(toDataSet, tcTable)
            Return loColumn.Contains(tcField)
        End Function

        ' Return True if the field exists in a table by the use of the columns
        ' expO1 Column collection
        ' expC1 Field
        Public Function FieldExistFromColumn(ByVal toColumn As DataColumnCollection, ByVal tcField As String) As Boolean
            Return toColumn.Contains(tcField)
        End Function

        ' See if a field exist from a datatable
        ' expO1 Datatable
        ' expC1 Field
        Public Function FieldExist(byval toDataTable As DataTable,ByVal tcField As String) As Boolean
            Dim lcFieldName As String = ""
            Dim llExist As Boolean = False
            Dim loRow As DataRow
            For Each loRow In toDataTable.Rows
                lcFieldName = loRow("ColumnName")
                If UCase(lcFieldName) = UCase(tcField) Then
                    llExist = True
                    Exit For
                End If
            Next
            Return llExist
        End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform