Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASP.NET locks files
Message
From
13/05/2006 11:39:52
 
 
To
13/05/2006 11:25:50
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 8.0
Miscellaneous
Thread ID:
01121566
Message ID:
01121658
Views:
13
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.

Other than this question, the rest of your code looks ok. Keep in mind that a DataAdapter.Fill() opens/closes the connection if necessary. But, if the connection was already open, the .Fill() will NOT close it (so your problem may be elsewhere).

I did a test with a WebService. I specifically opened the connection without closing it. I'm no longer even running the application (but obviously the Web Service is still running in IIS) and I still cannot exclusively open that table in VFP. Not until I specifically close that connection will I be able to do so.

~~Bonnie


>>OK, but that doesn't really matter ... you have to be sure you've closed your connection and I have a feeling that you didn't do that.
>
>Here is the SQLExec() method again. Is there something I need to adjust in there?
>
>
>        ' SQL exec
>        ' expC1 SQL command
>        ' expO1 Connection
>        Public Function SQLExec(ByVal tcSQL As String, ByVal tcConnection As String) As Boolean
>
>            ' If the applicatioan object has not been created
>            If oApp Is Nothing Then
>                Throw New System.Exception("The application object has not been passed to the data object.")
>            End If
>
>            ' If no connection string
>            If tcConnection.Length = 0 Then
>                oApp.cError = "Framework.Data.SQLExec() The connection string is empty. " + tcSQL
>                Return False
>            End If
>
>            InitializeDataObject(oApp.nSQLMode, tcConnection, tcSQL)
>            Dim llSuccess As Boolean
>            llSuccess = False
>            Try
>                oCommand.Connection = oConnection
>                oCommand.CommandText = tcSQL
>
>                ' Only add the parameters if we have some
>                If Not oParameters2 Is Nothing Then
>                    For Each oDataParameter In oParameters2
>                        oCommand.Parameters.Add(oDataParameter)
>                    Next
>                End If
>
>                oDataAdapter.SelectCommand = oCommand
>                oDataSet = New DataSet
>
>                ' By default, .NET does not add the specific field length, which is needed in XML as at the other end
>                ' someone would always get memo field instead of character field
>                oDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
>
>                oDataAdapter.Fill(oDataSet)
>
>                ' Adjust to our default name
>                oDataSet.Tables("Table").TableName = "Temp"
>
>                ' Record count
>                nCount = oDataSet.Tables("Temp").Rows.Count
>
>                ' If we have at least one record
>                If nCount > 0 Then
>                    oDataView = New DataView
>                    oDataView = oDataSet.Tables("Temp").DefaultView
>                End If
>
>                llSuccess = True
>            Catch loError As Exception
>                oApp.cError = oApp.ErrorSetup(loError, oApp.Debug(cSQL))
>            End Try
>            Return llSuccess
>        End Function
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform