31/03/2006

sql

esta com este erro: [Error] Unit1.pas(82): String literals may have at most 255 elements

Alguem pode me ajudar??


Inicio := DateToStr(DateTimePicker1.Date);
Final := DateToStr(DateTimePicker2.Date);
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.add(´select a.tabsitcod,a.canfennrocgccpf,a.estadocod,a.canfendatentrada,a.canfennum,a.canfendesserie, b.tabcfocod, b.tabtricod,SUM(b.itnfenvlrtotal+b.itnfenvlripi+b.itnfenvlricmst),SUM(b.itnfenvlrbasicmop),SUM(b.itnfenvlricmop),SUM(B.itnfenVLRIPI),SUM(b.itnfenvlrbasicmst),SUM(b.itnfenvlricmst),SUM(B.itnfenVLRTOTAL-B.itnfenvlrBASICMOP) from tnfcanfen a, tnfitnfen b´);
Query1.SQL.ADD(´where (a.canfennum = b.canfennum) and (a.tabsitcod <> 24) and ((b.tabtricod =´ + #39 + ´A´ + 39´) or (b.tabtricod = ´ + 39 + ´B´ + 39´)) and (a.fornecnro = b.fornecnro) and (a.canfendatentrada >=:pInicio) and (a.canfendatentrada <=:pFinal) and (b.tabcfocod = ´ + 39 + edit1.text + 39´)´);
Query1.SQL.ADD(´GROUP BY a.canfennrocgccpf, a.estadocod, a.canfendatentrada, a.canfennum, a.canfendesserie, b.tabcfocod, b.tabtricod, B.itnfenVLRTOTAL, B.itnfenvlrBASiCMOP, a.tabsitcod order by a.canfendatentrada´);
Query1.ParamByName(´pInicio´).AsDateTime := StrToDate(Inicio);
Query1.ParamByName(´pFinal´).AsDateTime := StrToDate(Final);
Query1.Prepare;
Query1.Open;


Cpd_arim

Respostas

31/03/2006

Georgecvenancio

Caro colega, tente quebrar sua estrutura de código na query, ex:

Inicio := DateToStr(DateTimePicker1.Date);
Final := DateToStr(DateTimePicker2.Date);
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.add(´ select a.tabsitcod, a.canfennrocgccpf, a.estadocod,´); Query1.SQL.add(´ a.canfendatentrada, a.canfennum,a.canfendesserie, ´);
Query1.SQL.add(´ b.tabcfocod, b.tabtricod,´);
Query1.SQL.add(´ SUM b.itnfenvlrtotal+b.itnfenvlripi+b.itnfenvlricmst),´);
Query1.SQL.add(´ SUM(b.itnfenvlrbasicmop),SUM(b.itnfenvlricmop),´);
Query1.SQL.add(´ SUM(B.itnfenVLRIPI),SUM(b.itnfenvlrbasicmst),´);
Query1.SQL.add(´ SUM(b.itnfenvlricmst),´);
Query1.SQL.add(´ SUM(B.itnfenVLRTOTAL-B.itnfenvlrBASICMOP) ´);
Query1.SQL.add(´ from tnfcanfen a, tnfitnfen b´);
Query1.SQL.ADD(´ where (a.canfennum = b.canfennum) and (a.tabsitcod <> 24) and ((b.tabtricod =´ + #39 + ´A´ + 39´) or (b.tabtricod = ´ + 39 + ´B´ + 39´)) and (a.fornecnro = b.fornecnro) and (a.canfendatentrada >=:pInicio) and (a.canfendatentrada <=:pFinal) and (b.tabcfocod = ´ + 39 + edit1.text + 39´)´);
Query1.SQL.ADD(´GROUP BY a.canfennrocgccpf, a.estadocod, a.canfendatentrada, ´);
Query1.SQL.add(´a.canfennum, a.canfendesserie, b.tabcfocod, ´);
Query1.SQL.add(´b.tabtricod, B.itnfenVLRTOTAL, B.itnfenvlrBASiCMOP, ´);
Query1.SQL.add(´a.tabsitcod order by a.canfendatentrada´);
Query1.ParamByName(´pInicio´).AsDateTime := StrToDate(Inicio);
Query1.ParamByName(´pFinal´).AsDateTime := StrToDate(Final);
Query1.Prepare;
Query1.Open;


Responder Citar