Board index » delphi » SQL.Add('SELECT * FROM' + Edit1.Text)

SQL.Add('SELECT * FROM' + Edit1.Text)

Quote
Christer Borgqvist wrote in message <01bd5daa$f9a97de0$cdd2f482@default>...
>Edit1.Text:=MyTableName2
>When i use this SQL.Add('SELECT * FROM' + Edit1.Text)
>i get an error
>General SQL error
>Token unknown-line 1,char 9
>FromMyTableName2

Need to add a space after 'FROM' :
SQL.Add('SELECT * FROM ' + Edit1.Text)
 

Re:SQL.Add('SELECT * FROM' + Edit1.Text)


Edit1.Text:=MyTableName2
When i use this SQL.Add('SELECT * FROM' + Edit1.Text)
i get an error
General SQL error
Token unknown-line 1,char 9
FromMyTableName2

Re:SQL.Add('SELECT * FROM' + Edit1.Text)


Quote
Christer Borgqvist wrote:

> Edit1.Text:=MyTableName2
> When i use this SQL.Add('SELECT * FROM' + Edit1.Text)
> i get an error
> General SQL error
> Token unknown-line 1,char 9
> FromMyTableName2

You must enter a space after the FROM
  SQL.Add('SELECT * FROM ' + Edit1.Text)

Also - if you are going to set this multiple times be sure that you
clear the SQL statement before you set it again.

ie :
  // Do this first to start with a clean slate!
  SQL.Clear;
  SQL.Add('SELECT * FROM ' + Edit1.Text)

HTH - Mike
--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:SQL.Add('SELECT * FROM' + Edit1.Text)


Christer Borgqvist a crit:

Quote
> Edit1.Text:=MyTableName2
> When i use this SQL.Add('SELECT * FROM' + Edit1.Text)
> i get an error
> General SQL error
> Token unknown-line 1,char 9
> FromMyTableName2

  Hi

just put a space character between the quote and FROM clause
('SELECT * FROM ' + Edit1.Text)

Mark

Other Threads