procedure TForm1.CheckListBox1ClickCheck(Sender: TObject);
//把多项选择的结果写进整型字段
var
  temp, i: Integer;
begin
  inherited;
  temp := 0;
  for i := 0 to CheckListBox1.Items.Count - 1 do
  begin
    if CheckListBox1.Checked[i] then
      temp := temp or (1 shl i);
  end;
  with Query1 do
  begin
    if not (State in [dsEdit, dsInsert]) then
      Edit;
    FieldByName('State').ASInteger := temp;
  end;
end;