Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 9 of 9 total |
double quote |
Sun, Nov 25 2007 2:58 PM | Permanent Link |
"Andrej Bivic" | I am filling SQL dinamically and I need to place some string constants in
it. How do I do that? In v2.12 I used "XX" but in ver4.25 " " are not allowed any more?! please, advise Query.SQL.Add(' where p.dokument = "VH" '); |
Sun, Nov 25 2007 3:06 PM | Permanent Link |
Eryk Bottomley | Andrej,
> I am filling SQL dinamically and I need to place some string constants in > it. How do I do that? In v2.12 I used "XX" but in ver4.25 " " are not > allowed any more?! > please, advise You use single quotes. Also, see the Engine.QuotedSQLString function in the help file. Eryk |
Sun, Nov 25 2007 4:38 PM | Permanent Link |
"Andrej Bivic" | But I need "quotes inside quotes".
Query.SQL.Add(' where p.dokument = "VH" '); "Eryk Bottomley" <no@way.com> wrote in message news:F50E6CD1-FB0B-4241-81C2-33E0D6807CEC@news.elevatesoft.com... > Andrej, > >> I am filling SQL dinamically and I need to place some string constants in >> it. How do I do that? In v2.12 I used "XX" but in ver4.25 " " are not >> allowed any more?! >> please, advise > > You use single quotes. Also, see the Engine.QuotedSQLString function in > the help file. > > Eryk |
Sun, Nov 25 2007 5:02 PM | Permanent Link |
"Robert" | "Andrej Bivic" <andrej.bivic@abitrade.si> wrote in message news:34FB9FCA-6CED-47DE-AB18-E4A4FAFA2197@news.elevatesoft.com... > But I need "quotes inside quotes". > Query.SQL.Add(' where p.dokument = "VH" '); > The double quote is decimal 34 select * from table where field = #34 + 'AB' + #34 Robert > > > "Eryk Bottomley" <no@way.com> wrote in message > news:F50E6CD1-FB0B-4241-81C2-33E0D6807CEC@news.elevatesoft.com... >> Andrej, >> >>> I am filling SQL dinamically and I need to place some string constants >>> in it. How do I do that? In v2.12 I used "XX" but in ver4.25 " " are not >>> allowed any more?! >>> please, advise >> >> You use single quotes. Also, see the Engine.QuotedSQLString function in >> the help file. >> >> Eryk > > |
Sun, Nov 25 2007 5:16 PM | Permanent Link |
Eryk Bottomley | Andrej,
> But I need "quotes inside quotes". > Query.SQL.Add(' where p.dokument = "VH" '); Yes, I know - so you double up the quotes as in any other case of string handling in Pascal: SQL.Add(' where p.dokument = ''VH'' ') ....this is also what the QuotedSQLString function does automatically. Eryk |
Sun, Nov 25 2007 5:20 PM | Permanent Link |
Eryk Bottomley | Robert,
> The double quote is decimal 34 > > select * from table where field = #34 + 'AB' + #34 That would only help if you had a column called 'AB' (including quotes) ....which I doubt is the case here (or anywhere else where sanity prevails . Eryk |
Mon, Nov 26 2007 3:57 AM | Permanent Link |
"Andrej Bivic" | If I put
where p.dokument = "VH" in dbSys I get an error (see the attachment). I was used to (ver2.12) use statements like Query.SQL.Add(' where p.dokument = "VH" '); where "VH" is a string constant. But in ver4.25 it doesnt work. Please, advise, how do I form such SQL statemest dinamically, which contains string constants. Andrej "Eryk Bottomley" <no@way.com> wrote in message news:4EB9FBFF-AC2E-46C7-80AF-A9C832DB246E@news.elevatesoft.com... > Andrej, > >> But I need "quotes inside quotes". >> Query.SQL.Add(' where p.dokument = "VH" '); > > Yes, I know - so you double up the quotes as in any other case of string > handling in Pascal: SQL.Add(' where p.dokument = ''VH'' ') > > ...this is also what the QuotedSQLString function does automatically. > > Eryk Attachments: DoubleQuoteError.doc |
Mon, Nov 26 2007 5:27 AM | Permanent Link |
Eryk Bottomley | Andrej,
> where p.dokument = "VH" in dbSys > > I get an error (see the attachment). Yes, because there is no field called "VH" in the table. Double quote characters ($34) denote quoted identifiers ...which in practice usually means means field names in SQL. You use a quoted identifier when you want to write something like: ...JOIN Table2 r ON p.dokument = r."spaces in this field name". > where "VH" is a string constant. But in ver4.25 it doesnt work. Please, > advise, how do I form such SQL statemest dinamically, which contains string > constants. You use single quotes ($39): WHERE p.dokument = 'VH'. If you want to embed that in Pascal code you have to double the single quotes: SQL.Add('WHERE p.dokument = ''VH''') ...the latter is standard behaviour for Pascal string handling and has nothing to do with databases per se. Note that: WHERE p.document = "VH" is: $34VH$34 ....this is NOT the same as: WHERE p.dokument = ''VH'' which is $39$39VH$39$39 Eryk |
Mon, Nov 26 2007 4:58 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Andrej,
<< I am filling SQL dinamically and I need to place some string constants in it. How do I do that? In v2.12 I used "XX" but in ver4.25 " " are not allowed any more?!>> As Eryk indicated, you need to use single quotes: Query.SQL.Add(' where p.dokument = ''VH'' '); // doubled-up single quotes around VH constant You can also just use this: Query.SQL.Add(' where p.dokument = '+Engine.QuotedSQLStr('VH')+' '); -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |