Jessy_ZA

Member since: Tuesday, 22 May 2018
Last login: 4 years ago
Profile viewed: 285 views

No Rank
Points: 0

Jessy_ZA created a new topic ' I need help with a project of mine' in the forum. 4 years ago

So i have a project for school but im getting this SQL Syntax error and i just cant seem to fix it

First chance exception at $76C23F12. Exception class EOleException with message 'Syntax error in INSERT INTO statement'. Process MainForm_P.exe (8848)

procedure TForm1.Button1Click(Sender: TObject);
var
Username, Password : string;
begin
Username := edtUsername.Text;
Password := edtPassword.Text;
with ADOQuery1 do begin
SQL.Clear;
SQL.Add ('INSERT INTO Accounts(Username,Password)');
SQL.Add('VALUES (:Username, :Password)');

Parameters.ParamByName('Username').Value := edtUsername.text;
Parameters.ParamByName('Password').Value := edtPassword.text;
ADOQuery1.ExecSQL;
end;
if ADOQuery1.RecordCount = 0 then
Application.MessageBox('Wrong Username', 'Error',
MB_OK or MB_ICONINFORMATION)
else
begin
if ADOQuery1.FieldByName('password').AsString <> edtPassword.Text
then Application.MessageBox('Be sure username and password is correct',
'Error', MB_OK or MB_ICONERROR)
else
begin
Form1.Hide;
Form2.Show;
end;
end;
end;

Read More...