dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 12 of 12

Thread: Error:Selected collating sequence not supported by the operating system

  1. #1
    Frank Guest

    Error:Selected collating sequence not supported by the operating system


    When I use ADO to open a text file, I got an error message:


    Selected collating sequence not supported by the operating system.

    The strange thing is that there is no any error when I use the same code
    to do the same thing.


    Any help would be highly appreciated.

    Thanks in advance.

    Frank

  2. #2
    Paul Clement Guest

    Re: Error:Selected collating sequence not supported by the operating system

    On 16 Dec 2002 08:02:21 -0800, "Frank" <gxie@morningstar.ca> wrote:


    When I use ADO to open a text file, I got an error message:


    Selected collating sequence not supported by the operating system.

    The strange thing is that there is no any error when I use the same code
    to do the same thing.


    If you could post a code example of what you're doing and identify the line where the error occurs
    it might give us a bit more to work with.


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  3. #3
    Frank Guest

    Re: Error:Selected collating sequence not supported by the operating system


    Hi, Paul,

    Here is my code(I made a little change for simplification

    Function NewRecordSetText(ByVal TxtfilePath As String, Optional ByVal Que
    As String) As adodb.Recordset
    On Error GoTo Handler
    Dim txtfile As String
    Dim txtpath As String
    Dim TryCount As Integer
    txtfile = UCase(Dir$(TxtfilePath))
    If Right(UCase(TxtfilePath), 4) = ".TXT" Then
    Set NewRecordSetText = New adodb.Recordset
    txtpath = Mid(TxtfilePath, 1, InStr(1, UCase(TxtfilePath), txtfile)
    - 2)
    Dim cn As String
    cn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & txtpath & ";" & _
    "Extended Properties='text;HDR=YES;FMT=Delimited'"
    If Que <> "" Then
    ' TryCount = 1
    'Retry:
    NewRecordSetText.Open Que, _
    cn, adOpenStatic, adLockReadOnly, adCmdText

    Else
    NewRecordSetText.Open "select * from " & txtfile, _
    cn, adOpenStatic, adLockReadOnly, adCmdText
    End If
    End If

    Exit Function
    Handler:
    Set NewRecordSetText = Nothing
    End Function

    The contents of file that is open is


    "Transaction_ID";"Account_ID";"Transaction_Type";"Transaction_Date_y";"Transaction_Date_m" ;"Transaction_Date_d";"Security_ID";"FundCode";"Security_Type";"Amount";"Unit";"Unit_Price ";"Currency";"Exchange_Rate";"WithHolding_Tax";"Fees";"FeeFormat";"Reinvest_
    Distribution";"Commision";"GrossAmount";"PAC_EndDate";"PAC_Frequency";"Contribution_Curren cy";"
    "1";"-1";"10";2001;"7639";"INV166";"1";"1000";"0";"0";"CA";"1";"0";"0";"0";"1";"0";"1000";01/01/3100;"0";"CA"
    "2";"-1";"10";1988;"4017";"ABC102";"1";"1000";"0";"0";"CA";"1";"0";"0";"0";"1";"0";"1000";01/01/3100;"0";"CA"
    "3";"-1";"10";1987;"3596";"AGF934";"1";"1000";"0";"0";"CA";"1";"0";"0";"0";"1";"0";"1000";01/01/3100;"0";"CA"

    I use the following call(assume the file name is tr.txt and in the current
    directory, i use ";" as delimiter):

    Set InTrRec = NewRecordSetText("tr.txt", "Select * From tr.txt Order By Account_ID,Security_Type,FundCode,Security_ID,Transaction_Date_y,Transaction_Date_m,Transa ction_Date_d
    Asc, Transaction_ID Asc")

    first call, get the error and call it again it is fine.

    I remove Asc from Order clause. It is ok even first call.

    What is wrong with ADO? If I need to specify DESC, what should I do? call
    twice.

    Thanks for any advice.

    Frank

    Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >On 16 Dec 2002 08:02:21 -0800, "Frank" <gxie@morningstar.ca> wrote:
    >
    >?
    >?When I use ADO to open a text file, I got an error message:
    >?
    >?
    >?Selected collating sequence not supported by the operating system.
    >?
    >?The strange thing is that there is no any error when I use the same code
    >?to do the same thing.
    >?
    >
    >If you could post a code example of what you're doing and identify the line

    where the
    >error occurs
    >it might give us a bit more to work with.
    >
    >
    >Paul ~~~ pclement@ameritech.net
    >Microsoft MVP (Visual Basic)



  4. #4
    Paul Clement Guest

    Re: Error:Selected collating sequence not supported by the operating system

    On 16 Dec 2002 12:14:40 -0800, "Frank" <gxie@morningstar.ca> wrote:


    Hi, Paul,

    Here is my code(I made a little change for simplification

    Function NewRecordSetText(ByVal TxtfilePath As String, Optional ByVal Que
    As String) As adodb.Recordset
    On Error GoTo Handler
    Dim txtfile As String
    Dim txtpath As String
    Dim TryCount As Integer
    txtfile = UCase(Dir$(TxtfilePath))
    If Right(UCase(TxtfilePath), 4) = ".TXT" Then
    Set NewRecordSetText = New adodb.Recordset
    txtpath = Mid(TxtfilePath, 1, InStr(1, UCase(TxtfilePath), txtfile)
    - 2)
    Dim cn As String
    cn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & txtpath & ";" & _
    "Extended Properties='text;HDR=YES;FMT=Delimited'"
    If Que <> "" Then
    ' TryCount = 1
    'Retry:
    NewRecordSetText.Open Que, _
    cn, adOpenStatic, adLockReadOnly, adCmdText

    Else
    NewRecordSetText.Open "select * from " & txtfile, _
    cn, adOpenStatic, adLockReadOnly, adCmdText
    End If
    End If

    Exit Function
    Handler:
    Set NewRecordSetText = Nothing
    End Function

    The contents of file that is open is


    "Transaction_ID";"Account_ID";"Transaction_Type";"Transaction_Date_y";"Transaction_Date_m" ;"Transaction_Date_d";"Security_ID";"FundCode";"Security_Type";"Amount";"Unit";"Unit_Price ";"Currency";"Exchange_Rate";"WithHolding_Tax";"Fees";"FeeFormat";"Reinves
    t_Distribution";"Commision";"GrossAmount";"PAC_EndDate";"PAC_Frequency";"Contribution_Curr ency";"
    "1";"-1";"10";2001;"7639";"INV166";"1";"1000";"0";"0";"CA";"1";"0";"0";"0";"1";"0";"1000";01/01/3100;"0";"CA"
    "2";"-1";"10";1988;"4017";"ABC102";"1";"1000";"0";"0";"CA";"1";"0";"0";"0";"1";"0";"1000";01/01/3100;"0";"CA"
    "3";"-1";"10";1987;"3596";"AGF934";"1";"1000";"0";"0";"CA";"1";"0";"0";"0";"1";"0";"1000";01/01/3100;"0";"CA"

    I use the following call(assume the file name is tr.txt and in the current
    directory, i use ";" as delimiter):

    Set InTrRec = NewRecordSetText("tr.txt", "Select * From tr.txt Order By Account_ID,Security_Type,FundCode,Security_ID,Transaction_Date_y,Transaction_Date_m,Transa ction_Date_d
    Asc, Transaction_ID Asc")

    first call, get the error and call it again it is fine.

    I remove Asc from Order clause. It is ok even first call.

    What is wrong with ADO? If I need to specify DESC, what should I do? call
    twice.


    I think this might be a bug in the IDE. I've seen a similar problem with Excel. Do you get an error
    when you compile and run the executable?


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Nov 2008
    Location
    Kentucky
    Posts
    4

    program error

    I have a form that uses a datagrid, and the data comes from a text file, that uses ODBC, Microsoft Text Driver. When I select the form, I get the error, "(Microsoft) (Text ODBC Text driver) Selected collating sequence not supported by the operating system". I click on OK, and the form loads and runs fine. It only comes up the first time I open the form. If I open the project, and comiple the application without opening the form in question, I get the same message during compile. I click on OK, and the compile finishes. The program runs OK, I just would like to know what is causing this error, and is it a concern.

    Thank you.

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    From what I've read, this will occur in the IDE, but not in a compiled program.

    Have you run your program as an EXE and experienced the same thing?

  7. #7
    Join Date
    Nov 2008
    Location
    Kentucky
    Posts
    4

    collating sequence error

    The program functions fine. I only get the error the first time I reference the form while working on the project, whether it is directly opening the form, or compiling the application. This application has been in use since 1998. The original schema.ini was created on Windows 98. When we load the app to a new laptop, all on Windows XP Professional, service pack 2, we place the schema.ini in the correct folder, then install the microsoft text driver in ODBC. We select the path, but do not re-define the format. I would say that has something to do with it. I only began seeing this message a few weeks ago, and it finally bugged me enough to try to figure out what the problem is.

  8. #8
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    BTW: Welcome to DevX

    Is Excel or Access involved in anyway?

    I ask, because all of the returns I got on this from Google mentioned either one or the other.

  9. #9
    Join Date
    Nov 2008
    Location
    Kentucky
    Posts
    4

    collating error message

    No. Every other file used by the application are plain text files. This is the only file that has any type of data base definition.

  10. #10
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Then I'm not sure why you are getting it.

    Here is what I got from Google.

    http://www.google.com/search?hl=en&q...ystem+text+fil

  11. #11
    Join Date
    Nov 2008
    Location
    Kentucky
    Posts
    4
    Yeah, I found that too, and others, but nothing helped. That's why I posted here. I found one about a bug that was identified, but it was only with service pack 3.
    Last edited by vbpgmr08; 11-06-2008 at 04:25 PM.

  12. #12
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    I found this
    Quote Originally Posted by WebBlog
    Have you ever tried using the Jet/OleDB driver to open a Tab Delimited Text file, without using Schema.ini? From what I can tell (googling and too much testing for what it is worth), you CANT. You must write out to the same folder as the data, a Schema.ini which is properly formatted for what you would like.

    Ugly, since most of us like to run as non-administrator it really sucks when we are not sure if we can even write to that same folder, so now we are forced to check for write permissions, attempt to write and if there are any failures kindly let the end user know that they must move the file to a "better" location. Why oh why!?

    The second option would be to overwite the default Format option in the registry; a quote from a article on MSDN reads:

    "Admittedly, opening the Registry, changing the value of Format, running the script, re-opening the Registry, and then changing the value back again can be a bit tedious, to say the least. But remember, you can change the registry from within your script."
    This quote came from here. Hope it helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center