CDS
Field.displayformt: 数据显示格式
TDBGridEh.InPlaceEditor :dbgrideh的编辑框
DBGrid1.Columns.Items[2].Field.value; //获得单元格的值
DBGrid1.SelectedRows.CurrentRowSelected 当前行是否选中
dbgrid1.SelectedRows.Count 有多少个选中行
DBGrid1.SelectedRows.CurrentRowSelected:=true; //true为选中该行
var
i,selectcount,docount:Integer;
s:string;
begin
selectcount:=dbgrid1.SelectedRows.Count;
Caption:='';
docount:=0;
ClientDataSet1.First;
while not ClientDataSet1.Eof do
begin
if selectcount=docount then Break;
if DBGrid1.SelectedRows.CurrentRowSelected then
begin
s:=DBGrid1.Columns.Items[2].Field.AsString; //获得值
Caption:=Caption+' '+s;
end;
ClientDataSet1.Next;
end;
end;
ADOQUERY执行多段SQL 把sql语句用begin...end包起來,再提交給DB处理,就OK了