Quote char in odbc query

marco.morreale
Member Posts: 58
How can I escape the quote charachter in a ODBC query?
I tried to double the quote: 'o''hara'
and the backslash char: 'o\'hara'
but none works.
Marco Morreale
I tried to double the quote: 'o''hara'
and the backslash char: 'o\'hara'
but none works.
Marco Morreale
0
Comments
-
Do you have your identifiers set to: a-z,A-Z-0-9,_ in the ODBC setup?0
-
No, I don't.
But my problem is value, not identifier.
I mean:
SELECT * WHERE name='o'hara'0 -
You must use double quotes instead of single quotes:
SELECT * WHERE name="o'hara"0 -
With the query:
SELECT * WHERE name="o'hara"
I get the error: Column not found: o'hara
It seems it considers it as a column name instead of a value.
Marco Morreale0 -
You'll have to post the complete code and tell us what language you are using to get further with this request.0
-
I am writing my .NET web application in C#.
I build the query then I submit to Navision ODBC driver 3.6.
Here is a code fragment:
string insertString = "INSERT INTO COMMERCE_PROSPECT ";
insertString += "(";
insertString += "NAME,";
insertString += "[NO],";
insertString += "PHONENO,";
insertString += "WEB_PROSPECT";
insertString += ") VALUES (";
insertString += "'" + RagioneSociale.ToUpper() + "',";
insertString += "'" + nrProspect + "',";
insertString += "'" + Telefono + "',";
insertString += "'" + "1" + "'";
insertString += ")";
The error occurs when the variable RagioneSociale (the name of my prospect) contains a quote charachter (o'hara, for instance)0 -
Use this approach instead:
insertString += "\"" + RagioneSociale.ToUpper() + "\",";0 -
First I want to thank you for your attention.
You mean to enclose the value with double quotes instead od single quotes?
The result string would be like:
INSERT INTO COMMERCE_PROSPECT (NAME) VALUES ("o'hara")
I've already tried that way with the query:
SELECT * WHERE name="o'hara"
But I got the error: Column not found: o'hara
Do you think the result may be different?
Marco Morreale0 -
I guess this topic may be dead at this point, but I was looking for an answer to an "INSERT" ODBC question myself.
Anyway I wanted to ask for a clarification on the last post.I tried to double the quote: 'o''hara'
I'm curious though if you ever managed to INSERT into Navision with ODBC without getting an error? I currently get a method not supported exception even though my record is inserted into the table I wanted.0 -
I used two single quotes but I couldn't make it work.
I often get the error "method not supported exception" but I just ignore it.
Navision ODBC seems to have many problems.
M0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions