![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Fri, Nov 10 2006 4:39 AM | Permanent Link |
tom_po | i have a table (orders) with a fielname pgroup (datatype=string)
in delphi i want to select only the orders which have the word "miss" in the column (fieldname) pgroup. when i test my query in database system utility, it works fine with this query: select * from orders where pgroup = 'miss' when i put the same code in my delphi-application like this: procedure TMainForm.DefineUnit1Click(Sender: TObject); begin showdbview('select Client,Order,Article as "Style",Pieces,minutes,pgroup as "Unit",' +'plancutting,plansewing,finaldate as "Delivery Date",observations as "Remarks"' +'from orders where pgroup = 'miss' and planfabric is not null and sewingout is null','Define Unit',true,true); end; i get the error message, not enought parameter when i make: .....where pgroup = miss and..... it is compiling well, but then dont choose only the orders with "miss" in pgroup, but all other orders too... what is wrong? |
Fri, Nov 10 2006 5:19 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | tom_po
showdbview Has nothing to do with DBISAM. If its your code can you show the procedure. However as a quick guess you need to double quote miss Roy Lambert |
Fri, Nov 10 2006 5:40 AM | Permanent Link |
tom_po | thanks Roy, for your prompt reply, i know, that my delphi-code have nothing to do with dbisam, but it dont work yet.
I tried, like you told me, with double quote miss showdbview('select Client,Order,Article as "Style",Pieces,minutes,pgroup as "Unit",' +'plancutting,plansewing,finaldate as "Delivery Date",observations as "Remarks"' +'from orders where pgroup = "miss" and planfabric is not null and sewingout is null','Define Unit',true,true); but now, i have all other orders, which don't have the word "miss" in this column pgroup, why? this i would understand, if i would do: ....where pgroup <> "miss" .... thanks Thomas Roy Lambert <roy.lambert@skynet.co.uk> wrote: tom_po showdbview Has nothing to do with DBISAM. If its your code can you show the procedure. However as a quick guess you need to double quote miss Roy Lambert |
Fri, Nov 10 2006 6:13 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | tom_po
When I said double quote I meant two single quotes. What I'd do is showdbview('select Client,Order,Article as "Style",Pieces,minutes,pgroup as "Unit",' +'plancutting,plansewing,finaldate as "Delivery Date",observations as "Remarks"' +'from orders where pgroup = '+QuotedStr('miss')+' and planfabric is not null and sewingout is null','Define Unit',true,true); Sometimes, when you have a complex string, its better to build that up in pieces so you can see whats going on eg SQLstr:= 'SELECT Client,Order,Article AS "Style",Pieces,minutes,pgroup AS "Unit",plancutting,plansewing,finaldate AS "Delivery Date",observations AS "Remarks"'; SQLstr:= SQLstr+'FROM orders'; SQLstr:= SQLstr+'WHERE'; SQLstr:= SQLstr+'pgroup = '+QuotedStr('miss'); SQLstr:= SQLstr+'AND'; SQLstr:= SQLstr+'planfabric IS NOT NULL' SQLstr:= SQLstr+'AND'; SQLstr:= SQLstr+'sewingout IS NULL'; showdbview(SQLstr,'Define Unit',true,true); Roy Lambert |
Fri, Nov 10 2006 6:53 AM | Permanent Link |
tom_po | thank you Roy so much, now it's working, with the first solution.
i tried then also with your suggestion (in pieces), it's compliling well, but then in applicaton i got the message ..found =... procedure TMainForm.DefineUnit1Click(Sender: TObject); var sqlstr: string; begin SQLstr:= 'SELECT Client,Order,Article AS "Style",Pieces,minutes,pgroup AS "Unit",plancutting,plansewing,finaldate AS "Delivery Date",observations AS "Remarks"'; SQLstr:= SQLstr+'FROM orders'; SQLstr:= SQLstr+'WHERE'; SQLstr:= SQLstr+'pgroup = '+QuotedStr('miss'); SQLstr:= SQLstr+'AND'; SQLstr:= SQLstr+'planfabric IS NOT NULL'; SQLstr:= SQLstr+'AND'; SQLstr:= SQLstr+'sewingout IS NULL'; showdbview(SQLstr,'Define Unit',true,true); end; i also corrected in your original code the missing ; in the line...SQLstr:= SQLstr+'planfabric IS NOT NULL' thanks for your help, Thomas Roy Lambert <roy.lambert@skynet.co.uk> wrote: tom_po When I said double quote I meant two single quotes. What I'd do is showdbview('select Client,Order,Article as "Style",Pieces,minutes,pgroup as "Unit",' +'plancutting,plansewing,finaldate as "Delivery Date",observations as "Remarks"' +'from orders where pgroup = '+QuotedStr('miss')+' and planfabric is not null and sewingout is null','Define Unit',true,true); Sometimes, when you have a complex string, its better to build that up in pieces so you can see whats going on eg SQLstr:= 'SELECT Client,Order,Article AS "Style",Pieces,minutes,pgroup AS "Unit",plancutting,plansewing,finaldate AS "Delivery Date",observations AS "Remarks"'; SQLstr:= SQLstr+'FROM orders'; SQLstr:= SQLstr+'WHERE'; SQLstr:= SQLstr+'pgroup = '+QuotedStr('miss'); SQLstr:= SQLstr+'AND'; SQLstr:= SQLstr+'planfabric IS NOT NULL' SQLstr:= SQLstr+'AND'; SQLstr:= SQLstr+'sewingout IS NULL'; showdbview(SQLstr,'Define Unit',true,true); Roy Lambert |
Fri, Nov 10 2006 4:13 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Tom,
<< i get the error message, not enought parameter >> Per email: You need to double the single-quotes around the string constant like this: showdbview(AnsiQuotedStr('select Client,Order,Article as "Style",Pieces,minutes,pgroup as "Unit",' +'plancutting,plansewing,finaldate as "Delivery Date",observations as "Remarks"' +'from orders where pgroup = 'miss' and planfabric is not null and sewingout is null'),'Define Unit',true,true); end; The key is the AnsiQuotedStr() function usage. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |