
//第166页源代码

Insert Into Customer(CustNo,Name,Country)
Values(:CustNo,:Name,:Country)


Query1.params[0].AsString := "1988";
Query1.params[1].AsString := "Lichtenstein";
Query1.params[2].AsString := "USA";


Query1.ParamByName('CustNo').AsString := "1988";
Query1.ParamByName('Name').AsString := "Lichtenstein";
Query1.ParamByName('Country').AsString := "USA";


Query1.Param.ParamValues['dept';name]:=VarArrayOf([StrToInt(Edit1.Text),Edit1.Text]);




//第167页源代码

try
Query1.close;
Query1.SQL.clear;
Query1.SQL.Add(Memo1.text);
Query1.Open;
Except
  On  EdatabaseError  do  Query1.ExecSQL
end;



//第177页源代码

var
i:integer;
begin
for i:=0 to (listbox1.items.count-1) do
begin
  if listbox1.selected[i] then
  begin
  table1.edit;
  //{将在listbox中选中的内容赋给当前记录的country字段}
  table1.FieldByName('country').asstring:=listbox1.items.string[i];
  table1.post;
  end;
end;
//{修改完毕后，将listbox隐藏起来}
listbox1.visible:=false;
end;



//第199页源代码

type 
  TDecisionDrawStates = (dsGroupStart, dsRowCaption, dsColCaption, dsSum, dsRowValue, dsColValue, dsData, dsOpenAfter, dsCloseAfter, dsRowIndicator, dsColIndicator, dsRowPlus, dsColPlus, dsNone);
  TDecisionDrawState = set of TDecisionDrawStates;
TDecisionDrawCellEvent = procedure (Sender: TObject; Col, Row: Longint; var Value: string; var AFont: TFont; var AColor: TColor; AState: TGridDrawState; ADrawState: TDecisionDrawState) of object;
property OnDecisionDrawCell: TDecisionDrawCellEvent;



//第199-200页源代码

var
flag:integer;
begin
if  aDrawstate=[dsData]  then
      begin
        if  Strtoint(Value)<3000  then
                 flag:=1
                 else
                 flag:=2;
       case  flag  of
           1:  Acolor:=clRed;
           2:  Acolor:=clBlue;
       end;
     end;
end;



//第204页源代码

if adrawstate=[dsdata] then
  begin
   if value<>'' then
     begin
       if strtoint(value)<3000 then
         acolor:=claqua
       else
         acolor:=clyellow;
     end;
  end;

//设置统计域中数据单元格的背景颜色
if adrawstate=[dssum,dsdata] then
  begin
    if strtofloat(value)<3000 then
      acolor:=claqua
    else
      acolor:=clyellow;
    if strtofloat(value)>10000.0 then
      acolor:=clred;
  end;
end;


