MySQL Forums
Forum List  »  Delphi

Re: How to execute this query
Posted by: Laurinaldo Guimarães
Date: February 28, 2007 07:13AM

Try it:

Var
// Wide string is better
sql : WideString;
begin
// Step 1

sql:='Insert into table1 (F1,F2,F3) values(1,2,3);';
ADOCommand1.CommandText := sql;
ADOCommand1.Execute;
// Step 2

sql:= 'Insert into table2 (F4,F5,F6) values(4,5,6);';
ADOCommand1.CommandText := sql;
ADOCommand1.Execute;
end;


or if you are using edit components try this way below:

var str1,str2,str3:widestring;
begin

// Using a single Filter on select
str1 := 'select LinCod, Fase, Name, Peso, IdINI, IdFIN, NrEnt from fases';
str2 := ' where lincod =';
str3 := ' where lincod <>';
If (Edit1.Text = '') or (Edit1.Text = '*')

then str1 := str1+str3+QuotedStr (Edit1.Text)
else str1 := str1+str2+QuotedStr (Edit1.Text) ;
ADODataSet1.Close;
ADODataSet1.CommandText := str1 ;
ADODataSet1.Open;

end;



Edited 4 time(s). Last edit at 02/28/2007 10:57AM by Laurinaldo Guimarães.

Options: ReplyQuote


Subject
Written By
Posted
January 17, 2007 07:41AM
January 20, 2007 12:10PM
Re: How to execute this query
February 28, 2007 07:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.