Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run time error too many variables under for next loop
Message
From
10/09/2004 14:21:49
 
 
To
10/09/2004 14:05:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00941135
Message ID:
00941154
Views:
11
Hello Steve,
Thank you very much.

Here is the code:
I just created a sample Procedure code, Please let me know:
*****************
Private Sub Command2_Click()
    Dim rsocd As New ADODB.Recordset
    Dim oconn As ADODB.Connection
    Dim rstemp As New ADODB.Recordset
    Dim s As String
    Dim maxno As Long
    Dim newno As Long
    Dim Item2 As String
    Dim sql As String
    Dim sqlid As String
    Dim txtfilename As String
    
    Dim fso As New FileSystemObject, txtfile, _
    fil1 As File, ts As TextStream
    FItem = File1.Path
        'Now the Database connection
    mytablepath
    Set oconn = New ADODB.Connection
    oconn.CursorLocation = adUseClient
    oconn.ConnectionString = "Provider=vfpoledb.1;Data Source=\\Myserver\pulic\PMIS.dbc;Collating Sequence=machine"
    oconn.Open
    oconn.Execute ("set null off")
   
    'Now the for Next loop
    For i2 = 0 To File1.ListCount - 1
        Set rsocd = Nothing
               
       rsocd.Open "Select * from ocrdata where ID = (Select max(id) from ocrdata)", oconn, adOpenDynamic, adLockOptimistic, adCmdText
        
        Item2 = File1.List(i2)
        'Getting new ID
         Set rstemp = Nothing

         rstemp.Open "SELECT OCID FROM ocrdataid", oconn, adOpenDynamic, adLockOptimistic, adCmdText
        
         If IsNull(rstemp!ocid) Then
             newno = 1
         Else
             maxno = rstemp!ocid
             newno = maxno + 1
         End If
         'rstemp.Update
         rstemp.Close
         Set rstemp = Nothing
                
        oconn.Execute "update ocrdataid set ocid=" & newno
                                        
    'Now getting the OCR content from text file (Item2)
        txtfilename = FItem & "\" & Item2
        Set fil1 = fso.GetFile(txtfilename)
        Set ts = fil1.OpenAsTextStream(ForReading)
        Do While Not ts.AtEndOfStream
            s = ts.ReadAll
        Loop
        Set fil1 = Nothing
        Set fso = Nothing
        Set ts = Nothing
        
        '**********Now the recordset
        rsocd.AddNew
            rsocd!id = newno
            If Item2 <> "" Then
             rsocd!tiffile = Trim(Item2)
            End If
            If s <> "" Then
             rsocd!ocdata = Trim(s)
            End If
            rsocd!created_dt = Date
        rsocd.Update
         
        Item2 = ""
        s = ""
        rsocd.Close
        Set rsocd = Nothing
    Next i2

End Sub
***************** End of code******************************
From VB i am able to do this:
oconn.Execute ("set null off")

When i tried to do the following from VB: oconn.Execute ("release all")

i got error:"one or more errors occured during processing of command"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform