The way I do it, is to have a const Ch: Char(39); have not got my laptop on,
I think it's the character code for a '

 

Then I use:  St:= 'SELECT * FROM table ORDER BY '+Ch+'realprm'+Ch;

And this gives me SELECT * FROM table ORDER BY 'realprm'

 

Steve

 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of David Smith
Sent: 06 October 2005 19:21
To: [email protected]
Subject: Re: [delphi-en] ' character in a string created with parameters

 

you can't use a parameter to subsitute for a column

name. In normal usage, the string quotes are

desirable.

You should generate the SQL string on the fly,

concatenating in the column name.

 

DJS

 

--- tarniadi <[EMAIL PROTECTED]> wrote:

 

> Hi all,

> 

> I'm using delphi 7 with MySql, and make my sql

> statements with 

> parameters facility.

> When I assign a string to a parameter with AsString

> option, it puts me 

> the character ' before and after my string that is

> to be inserted, and 

> the Mysql interpreter ignores that string resulting

> a bad dataset 

> returned.

> How can I avoid these ' characters?

> 

> E.g. SELECT * FROM table ORDER BY :prm

> which gives me

> SELECT * FROM table ORDER BY 'realprm'

> 

> Sincerely Adrian

> 

> 

> 

> 

> 

 

 

__________________________________________________

Do You Yahoo!?

Tired of spam?  Yahoo! Mail has the best spam protection around 

http://mail.yahoo.com 

 

 


 

-----------------------------------------------------

Home page: http://groups.yahoo.com/group/delphi-en/

To unsubscribe: [EMAIL PROTECTED] 

Yahoo! Groups Links

 

    http://groups.yahoo.com/group/delphi-en/

 

    [EMAIL PROTECTED]

 

    http://docs.yahoo.com/info/terms/

 

 

 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to