 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Patrick Guest
|
Posted: Fri Oct 13, 2006 7:57 pm Post subject: Trying to use TMemo.Lines with TADOQuery.Sql (in Delphi2006) |
|
|
In Delphi5 I am able to input an Sql select statement in a TMemo field, then
add the memo.Lines to the (TADOQuery) Sql string, and execute it:
if (memo.Lines.Count > 0) then begin
with qryTable do begin
Close;
Sql := memo.Lines;
ExecSql;
Open;
end;
end;
With Delphi2006 I get the error: [Pascal Error]: E2010 Incompatible types:
'TWideStrings' and 'TStrings'.
How can I (easily) do this in Delphi2006?
TIA--patrick |
|
| Back to top |
|
 |
Kevin Frevert Guest
|
Posted: Fri Oct 13, 2006 11:14 pm Post subject: Re: Trying to use TMemo.Lines with TADOQuery.Sql (in Delphi2 |
|
|
"Patrick" <pdohogne (AT) majorcustomcable (DOT) com> wrote in message
news:452fa958$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Sql := memo.Lines;
With Delphi2006 I get the error: [Pascal Error]: E2010 Incompatible types:
'TWideStrings' and 'TStrings'.
How can I (easily) do this in Delphi2006?
|
Sql.Text := Memo.Lines.Text;
Or wrap the opening of the query into a function/procedure passing the SQL
string.
procedure TdmSomeDatamodule.OpenData(const SQL: String);
begin
with qSomeQuery do
begin { Start of with ado ... do }
try { Start of try...except block }
Close;
if Length(SQL) > 0 then
begin
SQL.Text := SQL;
ExecSQL;
end;
except
on e: Exception do
begin
{set an custom error message property, raise a more 'user
friendly' error, etc}
end;
end; { End of try...except block }
end; { End of with ado.. do }
end;
Now the UI..
{some button click}
begin
dmSomeDatamodule.OpenData(Memo1.Lines.Text);
end;
Good luck,
krf |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|