1 Protected Function FilterDataTable(ByVal strFilterString As String, ByVal dtMainTable As Data.DataTable, ByVal strMessage As String) As Data.DataSet
2 Dim ResultData As New DataSet
3 Dim dtMessage As New Data.DataTable
4 Dim DataTableClon As New Data.DataTable
5 Dim drClon As System.Data.DataRow()
6 Dim dsDataFiltered As New Data.DataSet
7 Try
8 ResultData.Tables.Add(dtMainTable)
9 DataTableClon = ResultData.Tables(0).Copy
10 DataTableClon.Rows.Clear()
11 drClon = ResultData.Tables(0).Select(strFilterString)
12 For Each dr In drClon
13 DataTableClon.ImportRow(dr)
14 Next
15
16 dtMessage.TableName = "Header"
17 dtMessage.Columns.Add("ErrorMessage", GetType(System.String))
18 dsDataFiltered.Tables.Add(DataTableClon)
19 dsDataFiltered.Tables.Add(dtMessage)
20 Dim newMessageRow As DataRow = dsDataFiltered.Tables("Header").NewRow()
21 newMessageRow("ErrorMessage") = strMessage
22 dsDataFiltered.Tables("Header").Rows.Add(newMessageRow)
23
24 Catch ex As Exception
25 Call ManageError(strGlobalUser, strAppName, strModName, "FilterDataTable", intGlobalMain, Err, strGlobalPathError, ApplicationType.Web)
26 Finally
27 FilterDataTable = dsDataFiltered
28 End Try
29 End Function
2 Dim ResultData As New DataSet
3 Dim dtMessage As New Data.DataTable
4 Dim DataTableClon As New Data.DataTable
5 Dim drClon As System.Data.DataRow()
6 Dim dsDataFiltered As New Data.DataSet
7 Try
8 ResultData.Tables.Add(dtMainTable)
9 DataTableClon = ResultData.Tables(0).Copy
10 DataTableClon.Rows.Clear()
11 drClon = ResultData.Tables(0).Select(strFilterString)
12 For Each dr In drClon
13 DataTableClon.ImportRow(dr)
14 Next
15
16 dtMessage.TableName = "Header"
17 dtMessage.Columns.Add("ErrorMessage", GetType(System.String))
18 dsDataFiltered.Tables.Add(DataTableClon)
19 dsDataFiltered.Tables.Add(dtMessage)
20 Dim newMessageRow As DataRow = dsDataFiltered.Tables("Header").NewRow()
21 newMessageRow("ErrorMessage") = strMessage
22 dsDataFiltered.Tables("Header").Rows.Add(newMessageRow)
23
24 Catch ex As Exception
25 Call ManageError(strGlobalUser, strAppName, strModName, "FilterDataTable", intGlobalMain, Err, strGlobalPathError, ApplicationType.Web)
26 Finally
27 FilterDataTable = dsDataFiltered
28 End Try
29 End Function
No comments:
Post a Comment