Public Function Connection_Create_BasedOnType(Optional ByVal ConnStr As String = Nothing) As [Object]
If ConnectionType = ConnectionTypeCategories.ODBC Then
If ConnStr Is Nothing Then ConnStr = ConnectionString
Dim Connection As New Odbc.OdbcConnection(ConnStr)
Return Connection
ElseIf ConnectionType = ConnectionTypeCategories.OLEDB Then
If ConnStr Is Nothing Then ConnStr = ConnectionString
Dim Connection As New OleDb.OleDbConnection(ConnStr)
Return Connection
ElseIf ConnectionType = ConnectionTypeCategories.SQL Then
If ConnStr Is Nothing Then ConnStr = ConnectionString
Dim Connection As New SqlClient.SqlConnection(ConnStr)
Return Connection
End If
End Function
Public Function DataAdapter_Create_BasedOnType(Optional ByVal ConnStr As String = Nothing, Optional ByVal SqlStr As String = "") As [Object]
If ConnectionType = ConnectionTypeCategories.ODBC Then
If ConnStr Is Nothing Then ConnStr = ConnectionString
Dim Adapter As New Odbc.OdbcDataAdapter(SqlStr, ConnStr)
Return Adapter
ElseIf ConnectionType = ConnectionTypeCategories.OLEDB Then
If ConnStr Is Nothing Then ConnStr = ConnectionString
Dim Adapter As New OleDb.OleDbDataAdapter(SqlStr, ConnStr)
Return Adapter
ElseIf ConnectionType = ConnectionTypeCategories.SQL Then
If ConnStr Is Nothing Then ConnStr = ConnectionString
Dim Adapter As New SqlClient.SqlDataAdapter(SqlStr, ConnStr)
Return Adapter
End If
End Function