简体   繁体   中英

VB6 ADO recordset fieldname case sensitivity depends on Windows language settings

I have an ado recordset connected to an access database. I have a SELECT * Query. I access the fields as:

rs!ROMRightMinX

rs!ROMRightMaxX

rs!ROMRightMinY

rs!ROMRightMaxY

When I switch Windows to Hungarian, the nY combination in rs!ROMRightMinY becomes case sensitive. Meaning

rs!ROMRightMinY      Displays value

rs!ROMRightMInY      Displays value

rs!ROMRigHTMinY      Displays value

rs!ROMRightMiny      Field not found

rs!ROMRightMiNy      Field not found

rs!ROMRightMiNY      Field not found

The other fields work correctly. Similarly rs!ROMLeftMinY has the same issue. I've renamed the field to rs!ROMRightMiYY and it is no longer case sensitive.

All fields work correctly in other Windows languages.

Any thoughts?

Case-sensitivity in table and field names varies between database systems. The SQL92 spec says unquoted identifiers should be case-insensitive. But, quoted identifiers should be case-sensitive.

If you can't control the case of the field names in the underlying record source, change your SELECT query to something like this:

SELECT ROMRightMinX AS [ROMRightMinX], ROMRightMaxX AS [ROMRightMaxX], 
    ROMRightMinY AS [ROMRightMinY], ROMRightMaxY AS [ROMRightMaxY] ...

(Quoting may vary according to system, I use [] here)

This way, the underlying column gets a case-insensitive match, but the returned columns are case-sensitive, so they should match your code in all locales.

My guess is that it is because NY in Hungarian is a digraph . It corresponds with the behaviour you are describing. Ny , ny and NY are understood as one letter (the palatal nasal [ɲ]). NX is not a digraph in Hungarian so this works as you would expect.

Just for fun, try it with other Hungarian digraphs: cs , zs , gy , ly , ny , ty , dz , sz , and with the trigraph dzs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM