#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    1
    Rep Power
    0

    Connection error only during start-up


    Hi everyone,

    I'm trying to make an ADO connection to a csv file. (path and file name stored in string “PathImportDataBanken”, file name in “BestandImportDataBanken”)

    Every first time I start up my programme, the programme strands on the 'rs.open'-statement.

    the error-screen I'm getting (it's in Dutch):
    "Error # -2147467259 De geselecteerde instelling van de sorteervolgorde wordt niet ondersteund door het besturingssysteem."

    (In english: "Error # -2147467259 The selected option for sorting is not supported by the operating system.")

    Here's the connection-code: (VeldDatumImportDataBanken = date field)
    PHP Code:
      Dim cnn As ADODB.Connection
        Dim rs 
    As ADODB.Recordset
        Dim strSQL 
    As String
        
        Set cnn 
    = New ADODB.Connection
        Set rs 
    = New ADODB.Recordset
        rs
    .CursorLocation adUseClient
        
         cnn
    .ConnectionString "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" _
                    PathImportDataBanken 
    ";" _
                     
    "Extended Properties=""text;HDR=YES;FMT=Delimited(;)"";" _
                     
    "Persist Security Info=False"
         
    cnn.Open

         strSQL 
    "SELECT * FROM " BestandImportDataBanken "ORDER BY [" _
                    
    VeldDatumImportDataBanken "]"

         
    rs.Open strSQLcnnadOpenDynamicadLockOptimistic 
    I only receive the error when opening the programme for the FIRST time only... When I run the code a second or third time, no error appears.

    When a change :
    strSQL = "SELECT * FROM " & BestandImportDataBanken

    everything works fine from start-up.

    I'm using:
    -Visual Basic for applications 7
    -MS access 2010 reference to
    • VB for applications
    • MS access 14.0 Object Library
    • OLE automation
    • MS Office 14.0 access database engine object library
    • MS VB for applications extensibility 5.3
    • MS activeX data objects 6.0 library

    -Vista

    Your help and Time is appreciated.

    Best Regards,

    F.Degraeve, Belgium
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    I have never used the jet provider for text csv files.

    Doesn't ADO have a text file driver that may be easier? Just a guess, I have no idea on your problems, sorry.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain

IMN logo majestic logo threadwatch logo seochat tools logo