Results 1 to 17 of 17

Thread: [RESOLVED] Run-Time Error 3265

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    33

    Resolved [RESOLVED] Run-Time Error 3265

    Hello,

    Getting the below error (happens at red text) when running a sql command from vb. From other posts it appears to be due to invalid field names. But when I run the same script from Query Analyzer it returns the expected results. Is there a server setting that might cause this issue? I have no issues retreiving data from other types of databases, just this kind.

    Run-time error '3265': Item cannot be found in the collection to the requested name ordinal.
    vb Code:
    1. Public Sub ConnectToServer(Database As String)
    2.  
    3. '    On Error GoTo leave
    4.     Dim Kent As String
    5.    
    6.     If Conn1.State = adStateOpen Then Set Conn1 = Nothing
    7.     Conn1.Open "Driver={SQL Server};Server=LDMRMS01;Trusted_Connection=yes;"
    8.     Set Cmd1.ActiveConnection = Conn1
    9.     Cmd1.CommandTimeout = 600
    10.     If Len(Database) > 0 Then
    11.              Cmd1.CommandText = "Use " & Trim(Database)
    12.              Cmd1.Execute
    13.     End If
    14.     rs1.CursorLocation = adUseClient
    15.    
    16.     '!!!!TESTCODE
    17.     If Database = Trim(Exposure.ExposureDBs.Text) And Database > "" Then
    18.              Cmd1.CommandText = "SELECT PORTNAME, PORTINFOID From portinfo " & _
    19.             "GROUP BY PORTNAME, PORTINFOID ORDER BY PORTNAME"
    20.         [COLOR="Red"]rs1.Open Cmd1, , adOpenStatic, adLockBatchOptimistic[/COLOR]        
    21.       While Not rs1.EOF
    22.                  Kent = rs1(0)
    23.                  rs1.MoveNext
    24.         Wend
    25.         rs1.Close
    26.     End If
    27.     '!!!!TESTCODE
    28.    
    29.     GoTo leave2
    30. leave:
    31.     If Conn1.State = adStateOpen Then Set Conn1 = Nothing
    32.     If rs1.State = adStateOpen Then rs1.Close
    33. leave2:
    34.  
    35. End Sub
    Thanks for any help that might be provided!
    Last edited by Hack; Mar 21st, 2007 at 08:58 AM. Reason: Added VB Highlight Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width