I have the following procedure which is executed on a button click (button1). After being prompted to log into the database, delphi throws the the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''AlphaMc'
SELECT * FROM 'AlphaMc111'' at line 1'. Process Stopped. Use Step or Run to continue.
Here is the procedure:
procedure TMainWin.Button1Click(Sender: TObject);
begin
ADOConnection1.ConnectionString := 'Driver={MySQL ODBC 3.51 Driver};
Server=db4free.net;Port=3306;Database=inventmanager;User=******;
Password=******;Option=3;';
ADOConnection1.Connected := True;
ADOQuery1.Connection := ADOConnection1;
ADOQuery1.SQL.Add('SELECT * FROM ''AlphaMc111''');
ADOQuery1.Open;
end;
The MySql identifier quote character is the backtick, try
ADOQuery1.SQL.Add('SELECT * FROM `AlphaMc111`');