Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ASP.NET locks files
Message
De
13/05/2006 11:45:16
 
 
À
13/05/2006 11:39:52
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01121566
Message ID:
01121660
Vues:
19
>Looks like I'm not totally following all of your method:
>
>            InitializeDataObject(oApp.nSQLMode, tcConnection, tcSQL)
>            Dim llSuccess As Boolean
>            llSuccess = False
>            Try
>                oCommand.Connection = oConnection
>
>I don't see where oConnection comes from.
        Private Function InitializeDataObject(ByVal tnConnType As Integer, ByVal tcConnection As String, _
         ByVal tcSql As String) As IDbConnection
            Dim loEnumerator As IEnumerator = oParameters.GetEnumerator
            Dim loParameter As Object
            cConnectionString = tcConnection
            cSQL = tcSql

            ' This allows multiple SQL commands to be executed with the same set of parameters
            ' Otherwise, down below in this code, the oParameters2.Add() will keep adding the same
            ' set of parameters and an error will occur.
            ' So, basically, on each SQL commands, oParameters2 is propertly set based on loParameter
            oParameters2.Clear()

            Select Case tnConnType
                Case 1
                    oConnection = New OleDbConnection(tcConnection)
                    oDataAdapter = New OleDbDataAdapter
                    oCommand = New OleDbCommand
                    oDataParameter = New OleDbParameter
                    While loEnumerator.MoveNext
                        loParameter = loEnumerator.Current
                        oParameters2.Add(New OleDbParameter(loParameter(1, 1).ToString, loParameter(1, 2)))
                    End While
                Case 2
                    oConnection = New SqlConnection(tcConnection)
                    oDataAdapter = New SqlDataAdapter
                    oCommand = New SqlCommand
                    oDataParameter = New SqlParameter
                    While loEnumerator.MoveNext
                        loParameter = loEnumerator.Current
                        oParameters2.Add(New SqlParameter(loParameter(1, 1).ToString, loParameter(1, 2)))
                    End While
                Case 3
                    oConnection = New OdbcConnection(tcConnection)
                    oDataAdapter = New OdbcDataAdapter
                    oCommand = New OdbcCommand
                    oDataParameter = New OdbcParameter
                    While loEnumerator.MoveNext
                        loParameter = loEnumerator.Current
                        oParameters2.Add(New OdbcParameter(loParameter(1, 1).ToString, loParameter(1, 2)))
                    End While
            End Select
            Return oConnection
        End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform