>Imports System.Data >Imports System.Data.Common >Imports System.Data.OleDb >Imports System.Data.SqlClient >Imports System.Data.Odbc > >Public Class Data > > Public oDataSet As DataSet > Public oDataView As DataView > Public cSQL As String > Public cConnectionString As String > Public nCount As Integer > Public oParameters As New Collection > Public nSQLMode As Integer = Framework.App.nSQLMode > Private oConnection As IDbConnection = Nothing > Private oDataAdapter As IDbDataAdapter = Nothing > Private oCommand As IDbCommand = Nothing > Private oDataParameter As IDbDataParameter = Nothing > > ' SQL exec > ' expC1 SQL command > ' expO1 Connection > Public Function SQLExec(ByVal tcSQL As String, ByVal tcConnection As String) As Boolean > InitializeDataObject(nSQLMode, tcConnection, tcSQL) >. >. >. > > Public Function InitializeDataObject(ByVal tnConnType As Integer, ByVal tcConnection As String, _ > ByVal tcSql As String) As IDbConnection > cConnectionString = tcConnection > Select Case tnConnType > Case 1 > oConnection = New OleDbConnection(tcConnection) > oDataAdapter = New OleDbDataAdapter > oCommand = New OleDbCommand > oDataParameter = New OleDbParameter > Case 2 > oConnection = New SqlConnection(tcConnection) > oDataAdapter = New SqlDataAdapter > oCommand = New SqlCommand > oDataParameter = New SqlParameter > Case 3 > oConnection = New OdbcConnection(tcConnection) > oDataAdapter = New OdbcDataAdapter > oCommand = New OdbcCommand > oDataParameter = New OdbcParameter > End Select > Return oConnection > End Function > >End Class >>
> Dim loDataProvider As Framework.Data = New Framework.Data > loDataProvider.oParameters.Add(New OleDbParameter("@Username", lcUsername)) > If loDataProvider.SQLExec("SELECT Numero,Password,Session FROM " + tcTable + _ > " WHERE Username=?", tcConnection) = False Then > Return False > End If >>