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;
//把多项选择的结果写进整型字段
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;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货