Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Major mixup in two ASP.NET transactions
Message
From
28/09/2006 11:01:11
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01150471
Message ID:
01157855
Views:
61
>If oCommand is scoped to the hit (and only referenced within that scope) then the parameter collection should be clean. But what's the scope of oParameters2 and how is it populated?

oParameters is private to the class and populated as follow:
        Private oParameters As New ArrayList
        Private oParameters2 As New Collection
Each parameter is added by using this method into oParameters. Then,
        ' Add a parameter
        ' expC1 Field
        ' expO1 Value
        Public Function ParameterAdd(ByVal tcField As String, ByVal toValue As Object) As Boolean
            Dim loParameter(1, 2) As Object
            loParameter(1, 1) = tcField
            loParameter(1, 2) = toValue
            oParameters.Add(loParameter)
        End Function
Then, before each SQL method from the class, this method is called to set the proper type of connection, dataadapter, command and parameters. This is where oParameters2 is then initialized accordingly to the type of connection string used.
        Private Function InitializeDataObject(ByVal tcConnection As String, ByVal tcSql As String) As IDbConnection
            Dim loEnumerator As IEnumerator = oParameters.GetEnumerator
            Dim loParameter As Object
            cConnectionString = tcConnection
            cSQL = tcSql
            oParameters2.Clear()
            Select Case nSQLMode
                Case 1
                    oConnection = New OleDbConnection(tcConnection)
                    oDataAdapter = New OleDbDataAdapter
                    oCommand = New OleDbCommand
                    While loEnumerator.MoveNext
                        loParameter = loEnumerator.Current
                        oDataParameter = New OleDbParameter("@" + loParameter(1, 1).ToString, loParameter(1, 2))
                        oParameters2.Add(oDataParameter)
                    End While
                Case 2
                    oConnection = New SqlConnection(tcConnection)
>But, IAC, since the SELECT doesn't make use of parameters in this instance then an invalid parameter collection shouldn't cause the error.

Yes, but until we find this error, we cannot tell as there are a lot of weird reactions.

>Is MasterType a table or a view?

MasterType is a table.

>Where did the "Variable 'ADDDATE' is not found" message come from - .NET or VFP?

The backend is VFP.

>Can you put a try/catch just around some of these error points and simply STOP in the catch. The debugger might then provide clues to what goes wrong...

I will try that.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform