[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Delphi TIBQuery.SQL.Text contains ' gives an error

Posted on 2006-07-04
3
Medium Priority
?
314 Views
Last Modified: 2010-04-05
Hi Experts,

When executing a query runtime in Delphi which contains a " ' " (single quote) I terminates the query in gives an error?
What is the correct why of working with params which contains a ' ?

If not mistaken I am looking for something similar than PHP's stripslashes().

Thanks in advance!
0
Comment
Question by:Marius0188
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:Marius0188
ID: 17038021
For that matter please show me how to handle any invalid characters in a query params?
0
 
LVL 4

Expert Comment

by:kenpem
ID: 17038218
If the content of the query is under complete control of the code, use TWO single quotes within the string, as in:

Qry.SQL.Text := 'It doesn''t matter';

This is standard Object Pascal, to embed a single quote without terminating the string.

If possible, use the parameter functions to avoid conflicts:

Qry.SQL.Text := 'UPDATE Customer SET CustName = :uName';
Qry.ParamByName('uName') := EditBox1.Text;   // note that param syntax changes depending on BDE/ADO choice.

and now it shouldn't matter if the name is O'Donnell.

Hope this helps. Otherwise, paste here the bit of code that's bothering you and we'll have a go.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 17040607
there is also a quotedstr-function,
which does the double of the quotes if needed

meikl :-)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question