Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

working with quote

Posted on 2006-10-23
3
Medium Priority
?
194 Views
Last Modified: 2011-10-03
Hello guys,

I am having some  trouble to create a string this way

Str = 'Select * from table where field='' september" '

 Month := QuotedStr('' " '') + month_alias[StrToInt(Copy(Std[I],5,2))-1] + QuotedStr('' " '')

I tried several ways, but nothing so far

As you can see, I have a double quote in september

Thanks
0
Comment
Question by:hidrau
  • 2
3 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 17788982
the way to use quotedstr is:
month:= quotedstr( month_alias[StrToInt(Copy(Std[I],5,2))-1] );
which will result in 'september' for example
if you wan it to put in that select then use:

str:=quotedstr('Select * from table where fieId="+month_alias[StrToInt(Copy(Std[I],5,2))-1]+"')

though in this particular case of yours, I don't really see the need of quotedstr as you do not use single quotes in the string.
0
 
LVL 28

Accepted Solution

by:
2266180 earned 2000 total points
ID: 17789002
also keep in mind that
str:=quotedstr('Select * from table where fieId="+month_alias[StrToInt(Copy(Std[I],5,2))-1]+"')
will result in  'Select * from table where fieId="september"' WITH single quotes. in delphi that would be written as a constant
'''Select * from table where fieId="september"''' (see 3 single quotes at begining and end that represent 1 escaped single quote and a single quote so tha final string will actually contain a single quote at the beginig and end of the string. I am sure you don't want this ... but then again, you know better)
0
 
LVL 1

Author Comment

by:hidrau
ID: 17789021
Thanks very much ciuly
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview

783 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