Передача параметров ADO запросу

CONECT_STR='Provider=Microsoft.Jet.OLEDB.4.0;Password=" " ;User ID=Admin;'+{Data Source=D:\ExBd\ТЕРМО\Bd0.mdb;}
'Data Source=%s; Mode=Read|Write|Share Deny None;Extended Properties=" " ;'+
'Locale Identifier=1049;Persist Security Info=True;Jet OLEDB:System database=" " ;'+
'Jet OLEDB:Registry Path=" " ;Jet OLEDB:Database Password=" " ;Jet OLEDB:Engine Type=4;'+
'Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;'+
'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=" " ;'+
'Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;'+
'Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';

function TdmR3.GetCountForPeriod(LastDate: TDateTime; IsPlan: boolean): Integer;
var qu: TADOQuery;
S: String;
begin
qu:=TADOQuery.Create(nil);
try
S:=FormatDateTime('dd.mm.yy',LastDate);
qu.ConnectionString:=WideString(Format(CONECT_STR,[db_file]));
qu.SQL.Text:='select count(*) from DecadaVal as d where d.LastDate=:LastDate and IsPlan=:IsPlan';
qu.Parameters[0].Value:=LastDate;
qu.Parameters[1].Value:=IsPlan;
qu.Open;
Result:=qu.Fields[0].AsInteger;
finally
qu.Free;
end;
end;
 
« Предыдущая статья   Следующая статья »