//filling
STRSQL: = 'SELECT CDEPNAME, CDEPCode From Department'; rs.close; rs.s.sql.clear; rs.sql.add (strsql); rs.open; checklistbox1.clear; while not rs.eof do begin checklistbox1.items. Add (Rs.fieldVALUES ['cdepname']); rs.next; end;
// change the field values procedure Tfrmquanxian.CheckListBox1ClickCheck (Sender: TObject) database; varstrsql: string; begin // showmessage (CheckListBox1.Items [CheckListBox1.ItemIndex] '' DBGrid3.DataSource.DataSet.FieldValues [ 'dl_yhm' ]); if checklistbox1.checked [checklistbox1.itemindex] thenstrsql: = 'update quanxian set qx_shifou = 1 where qx_mk =' '' trim (CheckListBox1.Items [CheckListBox1.ItemIndex]) '' 'and qx_ren =' '' trim (DBGrid3.DataSource.DataSet.FieldValues [ 'dl_yhm']) '' '' elsestrsql: = 'update quanxian set qx_shifou = 0 where qx_mk =' '' trim (CheckListBox1.Items [CheckListBox1.ItemIndex]) '' 'and qx_ren =' '' TRIM (dbgrid3.datasource.DataSet.fieldValues ['DL_YHM']) '' '; rs.close; rs.sql.clear; rs.sql.add (strsql); Rs.execsql; end;