1

Why this does not work any longer on WinXP but works on Win7 and others?

qryS.SQL.Add('SELECT column');
qryS.SQL.Add('  FROM some_table');
qryS.SQL.Add(' WHERE param = :param1');
qryS.Parameters.ParamByName('param1').DataType := ftString;
qryS.Parameters.ParamByName('param1').Value := 'SomeValue';
qryS.Open;

Now I have to create the parameters specifically like:

qryS.ParamCheck := false
qryS.SQL.Add('SELECT column');
qryS.SQL.Add('  FROM some_table');
qryS.SQL.Add(' WHERE param = ?');
qryS.Parameters.CreateParameter('param', ftString, pdInput, 10, 'SomeValue');
qryS.Open;

Just to be clear, the second version works, but I would like to know why the first one doesn't anymore. The access violation has something about msado15.dll, don't know if that .dll has changed in some windows update recently ...

Don't know if matters but this happened just recently, maybe a month ago or so.

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Where exactly AccessViolation occurs? – Wodzu May 10 '13 at 15:44
  • I just tested using the MS drivers using `var DAmount: Double; begin ADOQuery1.SQL.Text := 'select * from testing where amount > :amount'; DAmount := 200; ADOQuery1.Parameters.ParamByName('Amount').Value := DAmount; ADOQuery1.Open; end;` in an XE4 VCL Forms application, connected the `ADOQuery` to a `DataSource` and the `DataSource` to a `DBGrid`, ran the app, and it worked fine. – Ken White May 10 '13 at 16:19
  • Did you try: qryS.Parameters.ParseSQL(qryS.SQL.Text,true); before accessing the parameters? – bummi May 10 '13 at 17:18
  • @Ken White : Did you try it on WinXP ? – user2370567 May 13 '13 at 09:50

0 Answers0