Message
De
21/09/2006 22:15:32
 
 
À
21/09/2006 20:17:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01156238
Message ID:
01156253
Vues:
14
For now, I have enhanced the method like this:
        ' FileToStr() VFP equivalent
        ' expC1 File name
        Public Function FileToStr(ByVal tcFileName As String) As String
            Dim lcString As String = ""
            Dim lnCounter As Integer = 0
            Dim lnDelay As Integer = 250
            Dim lnRetry As Integer = 8
            Dim loFile As IO.StreamReader
            For lnCounter = 1 To lnRetry
                Try
                    loFile = New IO.StreamReader(tcFileName, True)
                    lcString = loFile.ReadToEnd()
                    loFile.Close()
                Catch loError As Exception

                    ' If we have not reached the maximum tries of 8, we retry
                    If lnCounter < 8 Then

                        ' Wait for a timeout before retrying
                        System.Threading.Thread.Sleep(lnDelay)

                        Continue For
                    End If

                    ' Get the proper definition as per the current scope
                    If oProcess Is Nothing Then
                        oApp.ErrorSetup(loError)
                    Else
                        oProcess.ErrorSetup(loError)
                    End If

                End Try
            Next
            Return lcString
        End Function
It has a maximum retries to 8 and an interval of .25 second.
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
Suivant
Répondre
Fil
Voir