It would be better if you use Format

for example: DB.SQL.Add(Format('SELECT * FROM "%s" ORDER BY id DESC LIMIT
1,1',[table.TableName]));

The table name should be quoted in double quotes, do not forget to set the
DatabaseName or connection property for the DBExpress query, I haven't use
any so I dont know which one is applied for this component

    Also never iterate datasets using RecordCount, always use EOF

DB.First;
while not DB.Eof do begin
  for j:=0 to DB.Fields.Count - 1 do begin
      // Do what you are doing here
  end;
  DB.Next;
end;

Vahan


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] Behalf
Of smart9dotcom
Sent: Thursday, July 07, 2005 10:59 AM
To: [email protected]
Subject: [delphi-en] Re: fetch info with dbExpress ?


ok , now i am using open and this is new code ..

DB.Close;
DB.SQL.Clear;
table.TableName := 'MySmartBB';
DB.Open;

DB.SQL.Add('SELECT * FROM ' + table.TableName + ' ORDER BY id DESC
LIMIT 1,1');


DB.First;
for i:=0 to DB.RecordCount - 1 do
begin
str_ := '';
for j:=0 to DB.Fields.Count - 1 do
begin
if j >0 then
str_ := str_ + ', ';
str_ := str_;
str_ := DB.Fields[i].AsString;
end;
Memo1.Lines.Add(str_);
DB.Next;
end;
end;

but it's now show this error for me "Missing query , table name or
procedure name."




-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]



SPONSORED LINKS C programming language  Computer programming languages  The
c programming language
      C programming language  List of programming languages  Delphi
programmer


----------------------------------------------------------------------------
----
YAHOO! GROUPS LINKS

  a..  Visit your group "delphi-en" on the web.

  b..  To unsubscribe from this group, send an email to:
   [EMAIL PROTECTED]

  c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


----------------------------------------------------------------------------
----




[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to