Recent

Author Topic: Problem TSQLQuery.SQL.Text length (SOLVED)  (Read 7120 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Problem TSQLQuery.SQL.Text length (SOLVED)
« on: October 20, 2010, 11:45:24 am »
I have a query longer than 255 characters, and when I run crashes. How do you solve? Thanks
« Last Edit: October 20, 2010, 12:37:19 pm by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Problem TSQLQuery.SQL.Text length
« Reply #1 on: October 20, 2010, 12:04:20 pm »
try
TSQLQuery.SQL.DelimitedText :=

or
TSQLQuery.SQL.Clear;
TSQLQuery.SQL.Add('drop .....  ;');
TSQLQuery.SQL.Add('create .....  ;');
TSQLQuery.SQL.Add('select .....  ');

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Problem TSQLQuery.SQL.Text length (SOLVED)
« Reply #2 on: October 20, 2010, 12:15:58 pm »
Thank you!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Problem TSQLQuery.SQL.Text length (SOLVED)
« Reply #3 on: October 22, 2010, 02:21:21 am »
This?
TSQLQuery.SQL.DelimitedText := ?
 :D

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Problem TSQLQuery.SQL.Text length (SOLVED)
« Reply #4 on: October 22, 2010, 05:36:15 am »
This?
TSQLQuery.SQL.DelimitedText := ?
 :D
No! When

TSQLQuery.SQL.Clear;
TSQLQuery.SQL.Add('drop .....  ;');
TSQLQuery.SQL.Add('create .....  ;');
TSQLQuery.SQL.Add('select .....  ');
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

krexon

  • Jr. Member
  • **
  • Posts: 80
Re: Problem TSQLQuery.SQL.Text length (SOLVED)
« Reply #5 on: October 22, 2010, 09:20:02 am »
I often have over 5000 chars in queries and never had problems.
I do it in this way:
Code: [Select]
var q: string;
...
q:='';
q:=q+'SELECT ....';
q:=q+'UNION...';
q:=q+....';
...
SQLQuery.SQL.Text:=q;
SQLQuery.Open;
while not SQLQuery.EOF do
 begin
  SQLQuery.Next;
 end;
SQLQuery.Close;

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Problem TSQLQuery.SQL.Text length (SOLVED)
« Reply #6 on: October 23, 2010, 11:48:34 am »
smartcode :D
seems we fogot that when were going up.
move forward 8-)

 

TinyPortal © 2005-2018