Public Function AddDataSet(ByVal strSQL As String, ByVal arrData() As String, ByVal intTotalNumberOfFields As Integer) As Boolean
Try 'Initialize DataAdapter with SQL and connection string
SetConnectString()
mobjDA = New OleDb.OleDbDataAdapter(strSQL, strConnect)
mobjCB = New OleDb.OleDbCommandBuilder(mobjDA)
objDS.Clear()
mobjDA.Fill(objDS)
'Add new record to local memory
objRow = objDS.Tables(0).NewRow
For i = 0 To intTotalNumberOfFields
objRow(i) = arrData(i)
Next i
objDS.Tables(0).Rows.Add(objRow)
mobjDA.Update(objDS)
AddDataSet = True
Catch ex As Exception
str = "Error in AddDataSet. Error No. " & Err.Number & " : " & Err.Description
GetErrorMessage(str)
AddDataSet = False
Exit Function
End Try
End Function
Public Function SearchDataSet(ByVal strSQL As String) As DataSet
SetConnectString()
'Initialize DataAdapter with SQL and connection string
mobjDA = New OleDb.OleDbDataAdapter(strSQL, strConnect)
mobjCB = New OleDb.OleDbCommandBuilder(mobjDA)
objDS.Clear()
'Fill in DataSet
Try
mobjDA.Fill(objDS)
SearchDataSet = objDS 'Return dataset
Catch ex As Exception
str = "Error in SearchDataSet. Error No. " & Err.Number & " : " & Err.Description
GetErrorMessage(str)
Exit Function
End Try
End Function