Link to home
Start Free TrialLog in
Avatar of Nicholasjf
Nicholasjf

asked on

Why does formely good SQL code in Delphi 2009 not work under Windows 10?

Simple SQL Query usuing ADO in Delphi connected to Access Database:

procedure TForm1.Button1Click(Sender: TObject);
begin
With AdoQuery1 do begin
  Open;
  SQL.Clear;
  SQL.Add('SELECT * FROM Table1');
  SQL.Add('WHERE Number='+SpinEdit1.value);
  ExecSql;
end;
end;

Keeps throwing up the error: E2010 Incompatible types: 'string' and 'Integer'

Used to work fine in earlier version of Windows but every time an integer or double is used I get the same error. Thought it might have something to do with Access, but I ran the query just on Access and it worked fine. Have tried with both OLEDB 4.0 and 12.0 connections,
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nicholasjf
Nicholasjf

ASKER

You're right. My son sent me the wrong code. Thanks.
Doesn't it answer your question?
Fairly easy solution - it was me being dumb. But quick response and perfect answer. Thanks.