var aa:integer; begin aa := DBGrid1.DataSource.DataSet.fieldbyname('其中的一个字段名').AsInteger; ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from personnel_change where PersonId = ' + inttostr(aa)); ADOQuery1.Open; ADOQuery1.Active := True; ....
aa:integer;
begin
aa := DBGrid1.DataSource.DataSet.fieldbyname('其中的一个字段名').AsInteger;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from personnel_change where PersonId = ' + inttostr(aa));
ADOQuery1.Open;
ADOQuery1.Active := True;
....
Showmessage(DBGrid.DataSource.DataSet.Fields[j].AsString) //取列值
测试你的程序后,输出为空值。你测试过程序吗?
在DBGrid的单元格里按键通过其他控件(Lable等)输出即时的按键内容。
得到当前单元格中的内容
测试你的程序后,你的思路不可行,在即时按键时数据并未保存在数据库内。
在DBGrid的单元格里按键通过其他控件(Lable等)输出即时的按键内容。