我用两个TxMemData 怎么用代码实现主从表的关系
解决方案 »
- 线程访问vcl
- FastMM内存泄漏报告怎看呢??
- Application.Initialize之前找不到定义变量的地方
- 学校要分专业,c++ delphi java哪个有前途?
- 请问在Quickrpt中怎么表示checkbox啊?在数据库中保存的是0和1,给个表示的方法!谢谢!
- ACCESS数据库中设置了一数据类型为——自动编号的字段…………………………………………
- 怎样学delphi
- 请问如何用Delphi 控制 Word 画表格?
- 提问000
- wk_knife(我是石油工人多荣耀,头戴铝盔走天涯),100分,不成敬意,买包茶叶吧
- 求 google earth com api
- 什么时候要把类进行注册?怎样使用注册的类?
SQL.Add(SqlStr);
ExecSQL;
比如。有张三和李四两个选项,我绑定好了,
现在我又从数据库读出张三,然后显示在这个空间上.....ImageComboBoxEx1。Text:='张三' 这样不行
With TableMaster do
Begin
If Active Then
Active := False;
With FieldDefs Do
Begin
Clear;
Add('id', ftInteger);
....
End;
With IndexDefs Do
Begin
Clear;
Add('PrimaryKey', 'id', [ixPrimary]);
End;
CreateDataSet;
Active := True;
End;
做另一个DsDetails,其DataSet是TableDetails,这个Table的语句
With TableDetails Do
Begin
If Active Then
Active := False;
With FieldDefs Do
Begin
Clear;
Add('id', ftInteger);
Add('parent_id', ftInteger);
...
End;
With IndexDefs Do
Begin
Clear;
Add('PrimaryKey', 'id', [ixPrimary]);
Add('ByStudentId', 'parent_id', [ixCaseInsensitive]);
End;
CreateDataSet;
Active := True;
//主从关系由下面三句定
MasterSource := DsMaster;
MasterFields := 'id';
IndexFieldNames := 'parent_id';
End;