ZooFlow: Switch to new database
This commit is contained in:
@@ -85,29 +85,27 @@ Module ModuleHelpers
|
||||
End Try
|
||||
Return connectionString
|
||||
End Function
|
||||
Public Function FilterDatatable(myDatatable As DataTable, myFilter As String, mycheckColumn As String, pSortString As String, returnDT As Boolean) As Object
|
||||
|
||||
Public Function FilterDatatable(pDatatable As DataTable, pFilterString As String, pCheckColumn As String, pSortString As String, pReturnDataTable As Boolean) As Object
|
||||
Try
|
||||
If myDatatable.Rows.Count = 0 Then
|
||||
If pDatatable.Rows.Count = 0 Then
|
||||
Return Nothing
|
||||
End If
|
||||
Dim dv As DataView = myDatatable.DefaultView
|
||||
dv.RowFilter = myFilter
|
||||
If dv.Count = 1 And returnDT = False Then
|
||||
For Each rowView As DataRowView In dv
|
||||
Dim row As DataRow = rowView.Row
|
||||
Return row.Item(mycheckColumn)
|
||||
Next
|
||||
Dim oDataView As DataView = pDatatable.DefaultView
|
||||
oDataView.RowFilter = pFilterString
|
||||
If oDataView.Count = 1 And pReturnDataTable = False Then
|
||||
Dim oView As DataRowView = oDataView.Item(0)
|
||||
Dim oRow As DataRow = oView.Row
|
||||
Return oRow.Item(pCheckColumn)
|
||||
Else
|
||||
Dim dt_copy As DataTable = New DataTable()
|
||||
dt_copy = myDatatable.Select(myFilter, pSortString).CopyToDataTable()
|
||||
Dim oDataTableCopy As DataTable = New DataTable()
|
||||
oDataTableCopy = pDatatable.Select(pFilterString, pSortString).CopyToDataTable()
|
||||
|
||||
Return dt_copy
|
||||
Return oDataTableCopy
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected error in FilterDatatable: " + ex.Message, MsgBoxStyle.Critical)
|
||||
MsgBox("Unexpected Error in FilterDatatable: " + ex.Message, MsgBoxStyle.Critical)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
End Module
|
||||
|
||||
Reference in New Issue
Block a user