主题:请教关于表单中一对多关联的两个表彻底删除的问题?
一个表单的数据环境加入了两个相互关联的表,一个子表,一个父表,父表对子表是一对多关联。在用PACK命令作删除操作时,虽然用代码又重新建立了关联,但表格中的记录还是不随主表中的记录变化,请各位楼主帮忙解决一下?代码如下:
select ygbiao
*ygbiao是子表名
thisform.grdygbiao.readonly=.f.
getid=alltrim(thisform.grdygbiao.column2.text1.value)
*存储当前员工的编号
getno=thisform.combo1.listindex
thisform.grdygbiao.recordsource=""
use ygbiao exclusive
set order to ygbianhao
seek getid
delete
pack
use ygbiao shared
set order to ygbianhao
select bumeng
*bumeng是主表名
set order to bumengbian
set relation to ygbianhao into ygbiao
set skip to ygbiao
thisform.grdygbiao.recordsource="ygbiao"
thisform.grdygbiao.refresh
thisform.combo1.listindex=getno
thisform.combo1.setfocus
select ygbiao
*ygbiao是子表名
thisform.grdygbiao.readonly=.f.
getid=alltrim(thisform.grdygbiao.column2.text1.value)
*存储当前员工的编号
getno=thisform.combo1.listindex
thisform.grdygbiao.recordsource=""
use ygbiao exclusive
set order to ygbianhao
seek getid
delete
pack
use ygbiao shared
set order to ygbianhao
select bumeng
*bumeng是主表名
set order to bumengbian
set relation to ygbianhao into ygbiao
set skip to ygbiao
thisform.grdygbiao.recordsource="ygbiao"
thisform.grdygbiao.refresh
thisform.combo1.listindex=getno
thisform.combo1.setfocus