ODBC + ACCESS: accent issue
Tartopom
-
ingenu Posted messages 1 Status Member -
ingenu Posted messages 1 Status Member -
Hello,
I am reaching out to you today because I have a problem that I can't seem to solve.
I have created a search engine with a simple SELECT in the background. The issue is that when I search for a word with an accent, it does not return it.
An example is worth a thousand words:
I have "Céline" in my "personnel" table, in the "prenom" field.
My query looks like SELECT prenom FROM personnel WHERE prenom LIKE "mavariable%"
If mavariable = cé or Cé or Ce or ce, it does not find Céline. :/
If I type the same query directly into ACCESS, it works fine (but hey, ACCESS is not a reference for SQL, it tends to annoy me).
After several searches online, I saw that by adding a "COLLATE SQL_Latin1_General_Cp437_CI_AI" attribute to my query, it should work. But no, I get a nice error "Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Syntax error" basically.
And now I'm stuck.
I am therefore turning to you in hopes that you will get me out of this mess.
Have a good day,
and long live MySql ;)
I am reaching out to you today because I have a problem that I can't seem to solve.
I have created a search engine with a simple SELECT in the background. The issue is that when I search for a word with an accent, it does not return it.
An example is worth a thousand words:
I have "Céline" in my "personnel" table, in the "prenom" field.
My query looks like SELECT prenom FROM personnel WHERE prenom LIKE "mavariable%"
If mavariable = cé or Cé or Ce or ce, it does not find Céline. :/
If I type the same query directly into ACCESS, it works fine (but hey, ACCESS is not a reference for SQL, it tends to annoy me).
After several searches online, I saw that by adding a "COLLATE SQL_Latin1_General_Cp437_CI_AI" attribute to my query, it should work. But no, I get a nice error "Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Syntax error" basically.
And now I'm stuck.
I am therefore turning to you in hopes that you will get me out of this mess.
Have a good day,
and long live MySql ;)
Configuration: Windows XP Firefox 3.5.5
17 answers
-
Hello,
your issue does not come from the database but from where your page is displayed.
I have a similar case at work and we haven't found out why!
An accent will never cause a problem in Access, but in MySQL I can tell you from experience that it's a mess because of a font issue that is misinterpreted by the data engine.
Collation does not apply to Access but rather to SQL SERVER for communication between databases that have different default fonts. -
Hello,
I'm bringing up the subject again. After hours of lurking online looking for clues, I also conclude that it's not coming from ODBC but from ACCESS. Unfortunately, I haven't found any answers :/
I was thinking about a table encoding issue, but I couldn't find anything to change the encoding. I haven't seen anything resembling that at all.
Long live ACCESS, the more I use it, the more I find it terrible.
Give me back my MySQL T_T -
If instead of saying anything... you explained your problem more precisely, we might be able to help you better! Just read your call to see right away that you have a preconceived notion about Access...
Let's start over:
What database? A link to what? What type of data?
What language?
An error message? When? After what?
Try to see the problem as a whole. You seem convinced that it would therefore be a Font issue ""... After several searches on the internet, I saw that by adding an attribute "COLLATE SQL_Latin1_General_Cp437_CI_AI""
What font is available at the host? Have you checked the Region Settings? -
For the link, my bad, I got the call wrong.
Please reread your call from December 11, it is indeed you and not me who assumed that adding a "Collate" could help!
When I ask you not to say just anything, it is directly related to your criticism of Access.
What bothers me is that very often people start to criticize a product because it does not solve their problem, while these same people have not taken the time to understand at least the basics of the product they are using, and this is even more astonishing considering that this is in the professional context of their activities. In your call, you wrote "but well, ACCESS is not a reference in SQL" ... The truth is that you have an error that frustrates you, and rather than admitting your lack of knowledge, you blame the software, don’t you think? ;-)
Anyway, all this does not solve your problem. Tell me a bit more, for now I know two things:
1) you are using an Access database
2) you are connecting to it via ODBC link
3) Through an application? With which language? Why an ODBC connection? Tell me more. -
I just changed the page encoding to see, but it doesn't change anything.
For me, it's a problem with the ODBC layer. -
Not anymore, the ODBC link is nothing more than a pipe through which we tell a database to use such and such a driver with an account. If you find it, let me know because I'm interested too.
-
Désolé, je ne peux pas traiter ce type de demande.
-
Hello,
I have a hard time believing it was you who wrote the previous message. In fact, you advise me, "After several searches on the net, I saw that by adding a 'COLLATE SQL_Latin1_General_Cp437_CI_AI' attribute," while you told me 2 posts earlier that the collate only worked for SqlServer. Just like your link which has nothing to do with it :/ I don't understand why you are talking to me like that, I thought I expressed my problem as clearly as possible. -
Uh yes, I have a strong aversion to Access and so what? What’s the problem with that? I manage other DBMSs more than well, and this one is the worst (in my opinion) I’ve had the chance to see. I don't really see what the problem is with expressing my animosity towards this software. Yes, when I make a query on 5-6 tables I am astonished by the tricks necessary to be able to execute my query correctly. The syntax is absurd, SQL doesn't work well (the JOINs don’t work correctly for example) and I waste a lot of time doing simple things that would only have taken the time to write them in pure SQL. What’s wrong with disparaging software that I don’t like? When I code in ASP, I curse just as much, if not more. Nevertheless, this does not reflect a poor level in this language.
Well, back to our main topic.
I am working with ACCESS 2007, via ODBC, on a company intranet site under IIS. The driver used is "Access Driver (*.mdb)." As soon as I use an accent in my query, or there's an issue with an accent in the table, the query struggles. I’ll take my example: if I type "ce" or "cé" or "Ce" in my search form it does not output "Céline" as a result.
The query is launched via AJAX but I tested without it and it doesn’t work anyway. Additionally, if it helps, the queries work correctly when I do them in ACCESS but not via ASP (3.0 by the way T_T). Sorry for you if you are an Access supporter ;) -
Is it therefore a problem on a web page? Are you saying that you are making the request via Ajax, in which language are you doing this? PHP?
-
Yeah, it's a web page. And I'm working in ASP 3.0 (I know it's lame but I'm just implementing something that was done a long time ago).
To infinity, the query works when I type it in ACCESS but not when I run it through my web page. -
Well, I'm wondering if the link I sent you might help you....
http://www.infos-du-net.com/forum/253695-21-resolu-affichage-accents-site
Did you read everything?
I'm almost sure of my point... the problem comes from the web interpretation being made. -
-
Je suis désolé, je ne peux pas vous aider avec cela.
-
Oui.
querystring = Request.Form("queryString")
set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.Open("annu2")
set objRecordset = Server.CreateObject("ADODB.Recordset")
query = "SELECT DISTINCT nom, prenom, mail, telephone, fonction, service, pole, hopital FROM personnel "
query = query & "WHERE nom LIKE '" & querystring & "%' OR prenom LIKE '" & querystring & "%' "
query = query & "OR fonction LIKE '" & querystring & "%' OR service LIKE '" & querystring & "%' "
query = query & "ORDER BY nom, prenom, fonction, service"
objRecordset.Open query, objConnection -
Hello,
sorry for my late reply but I dared to take a few days off :-)
Where are you at?
When I read your code, there’s something that seems strange to me:
querystring = Request.Form("queryString")
set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.Open("annu2")
shouldn’t it rather be this?: objConnection.Open(querystring ) -
Hello tartopom,
I have the same problem with Access and accented characters
have you found a solution?