pucko
asked on
delphi and sql problem
I have this:
try
Query1.Close;
Query1.SQL.Clear;
Buf:= 'insert into q_term (quote_no,version,alternat e,cust_alt ,id,idx,te rmtext,typ e,sortorde r)'+
' select ' + intToStr(max_no)+',version ,alternate ,cust_alt, id,idx,ter mtext,type ,sortorder from '+
'q_term where quote_no=' +IntToStr(ThisQuotation.qu ote_no)+ ' and alternate=' + intToStr(ThisQuotation.alt ernate)
+ ' and version=' + intToStr(ThisQuotation.ver sion);
Query1.SQL.Add(Buf);
Query1.Open;
except on E: Exception do
begin
Screen.Cursor:= crDefault;
Application.MessageBox(PCh ar(E.Messa ge), PChar(Application.Title), mb_OK+mb_IconStop);
Exit;
end;
end;
And I get the error message:
E.Database Error with message
Query1: CommandText does not return a result set.
When I toggle to inspect mode and cut the sql query from the inspector into the queryAnalyzer the sql query does not give any errors.
What is wrong in my code?
try
Query1.Close;
Query1.SQL.Clear;
Buf:= 'insert into q_term (quote_no,version,alternat
' select ' + intToStr(max_no)+',version
'q_term where quote_no=' +IntToStr(ThisQuotation.qu
+ ' and version=' + intToStr(ThisQuotation.ver
Query1.SQL.Add(Buf);
Query1.Open;
except on E: Exception do
begin
Screen.Cursor:= crDefault;
Application.MessageBox(PCh
Exit;
end;
end;
And I get the error message:
E.Database Error with message
Query1: CommandText does not return a result set.
When I toggle to inspect mode and cut the sql query from the inspector into the queryAnalyzer the sql query does not give any errors.
What is wrong in my code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops, mnasman was faster.
F.
F.
ASKER
Thnks
In order to solve that you will have to use ExecSQL instead of Open.
Good luck,
F.