在vfp中如何用代码向表单的数据环境中添加表
因为在程序运行的过程中,动态的生成一些表,如何用代码把这些表加入表单的数据环境中以便对表进行操作。这样吧,我把问题讲清楚:我的软件每次开始运行时都要更新几个远程视图(事先...
因为在程序运行的过程中,动态的生成一些表,如何用代码把这些表加入表单的数据环境中以便对表进行操作。
这样吧,我把问题讲清楚:我的软件每次开始运行时都要更新几个远程视图(事先已有,并已加入数据环境中了),这时系统老是提问要不要覆盖原有的表(软件的意图就是要覆盖的),这就造成我每次都要回答“是”,我觉得很麻烦!用户使用也不方便!问各位高手有没有办法不让那对话框出现而又能达到更新表的目的!要不然我只能在软件退出时删除视图,这样就不会出现对话框,但又出现要重新加载数据环境了!我试过 在环境设置代码中添加下面这句代码
set safety off 虽然对话框没出现,但数据也没有得到更新,因为对话框默认就是“否”,怎办? 展开
这样吧,我把问题讲清楚:我的软件每次开始运行时都要更新几个远程视图(事先已有,并已加入数据环境中了),这时系统老是提问要不要覆盖原有的表(软件的意图就是要覆盖的),这就造成我每次都要回答“是”,我觉得很麻烦!用户使用也不方便!问各位高手有没有办法不让那对话框出现而又能达到更新表的目的!要不然我只能在软件退出时删除视图,这样就不会出现对话框,但又出现要重新加载数据环境了!我试过 在环境设置代码中添加下面这句代码
set safety off 虽然对话框没出现,但数据也没有得到更新,因为对话框默认就是“否”,怎办? 展开
2个回答
展开全部
首先在表单的数据环境中预先加几个表,如我的建筑租赁管理商业软件中的计算的一个窗体,预先加zlmxb0、zlmxb1表,在程序运行的过程中,动态的生成一些表,然后对某些数据控件使用:
.RecordSourceType=1
.RecordSource=thisform.dataenvironment.cursor1.alias
即可。
以下是例子:
select zlmxb0
with thisform.grdzlmxb0
.RecordSourceType=1
.RecordSource=thisform.dataenvironment.cursor1.alias
.column1.width=75
.column1.readonly=.T.
.column2.width=75
.column3.width=75
.column4.width=75
.column5.width=75
.column6.width=75
.column7.width=75
.column1.header1.caption="租用代码"
.column2.header1.caption="租用日期"
.column3.header1.caption="租用合同号"
.column4.header1.caption="经办人"
.column5.header1.caption="除渣单价"
.column6.header1.caption="刷油单价"
.column7.header1.caption="维修单价"
.ScrollBars=2
.refresh
ENDWITH
select zlmxb1
WITH thisform.grdzlmxb1
.RecordSourceType=1
.RecordSource=thisform.dataenvironment.cursor4.alias
.column1.width=100
.column2.width=100
.column3.width=100
.column4.width=100
.column1.readonly=.T.
.column2.readonly=.T.
.column1.header1.caption=" 序 号 "
.column2.header1.caption="材料代码"
.column3.header1.caption="租赁数量"
.column4.header1.caption="日租金价格"
.ScrollBars=2
ENDWITH
.RecordSourceType=1
.RecordSource=thisform.dataenvironment.cursor1.alias
即可。
以下是例子:
select zlmxb0
with thisform.grdzlmxb0
.RecordSourceType=1
.RecordSource=thisform.dataenvironment.cursor1.alias
.column1.width=75
.column1.readonly=.T.
.column2.width=75
.column3.width=75
.column4.width=75
.column5.width=75
.column6.width=75
.column7.width=75
.column1.header1.caption="租用代码"
.column2.header1.caption="租用日期"
.column3.header1.caption="租用合同号"
.column4.header1.caption="经办人"
.column5.header1.caption="除渣单价"
.column6.header1.caption="刷油单价"
.column7.header1.caption="维修单价"
.ScrollBars=2
.refresh
ENDWITH
select zlmxb1
WITH thisform.grdzlmxb1
.RecordSourceType=1
.RecordSource=thisform.dataenvironment.cursor4.alias
.column1.width=100
.column2.width=100
.column3.width=100
.column4.width=100
.column1.readonly=.T.
.column2.readonly=.T.
.column1.header1.caption=" 序 号 "
.column2.header1.caption="材料代码"
.column3.header1.caption="租赁数量"
.column4.header1.caption="日租金价格"
.ScrollBars=2
ENDWITH
ZESTRON
2024-09-04 广告
2024-09-04 广告
表面污染分析包括评估表面上存在的颗粒、残留物或物质。通过利用显微镜、光谱学和色谱法等技术,分析人员可以识别和表征污染物,以确定其成分和来源。这种分析在电子、制药和制造等各个行业中至关重要,以确保产品质量、性能和安全性。了解表面污染有助于实施...
点击进入详情页
本回答由ZESTRON提供
展开全部
select * form tablename into cursor/table aa
select aa
然后对aa操作
直接在主程序中添加这样一句代码就搞定
或者在你的环境设置代码中添加下面这句代码
set safety off
希望你看得懂英语
SET SAFETY ON | OFF
Parameters
ON
(Default) Specifies that a dialog box is displayed before you overwrite an existing file. The dialog box gives you the option of overwriting the existing file.
For the Table Designer, specifies that table or field rules, default values, and error messages are evaluated when you save changes to a table's structure. Data validation occurs for new or modified validation rules after you save the table structure changes. If a validation rule contains a UDF (user-defined function), the UDF isn't evaluated and the validation rule is ignored.
For ALTER TABLE, table or field rules, default values, and error messages are evaluated when ALTER TABLE changes the table's structure. Data validation occurs for new or modified validation rules when ALTER TABLE changes the table's structure. If a validation rule contains a UDF (user-defined function), the UDF isn't evaluated and the validation rule is ignored.
OFF
Specifies that a dialog box isn't displayed before an existing file is overwritten. Note that for in-process .dll automation servers the default setting of SET SAFETY is OFF.
For the Table Designer, specifies that table or field rules, default values, and error messages are not evaluated when you save changes to a table's structure. However, data validation occurs for new or modified validation rules after you save the table structure changes.
For ALTER TABLE, table or field rules, default values, and error messages are not evaluated when ALTER TABLE changes the table's structure. Data validation does not occur for new or modified validation rules after ALTER TABLE changes the table's structure.
select aa
然后对aa操作
直接在主程序中添加这样一句代码就搞定
或者在你的环境设置代码中添加下面这句代码
set safety off
希望你看得懂英语
SET SAFETY ON | OFF
Parameters
ON
(Default) Specifies that a dialog box is displayed before you overwrite an existing file. The dialog box gives you the option of overwriting the existing file.
For the Table Designer, specifies that table or field rules, default values, and error messages are evaluated when you save changes to a table's structure. Data validation occurs for new or modified validation rules after you save the table structure changes. If a validation rule contains a UDF (user-defined function), the UDF isn't evaluated and the validation rule is ignored.
For ALTER TABLE, table or field rules, default values, and error messages are evaluated when ALTER TABLE changes the table's structure. Data validation occurs for new or modified validation rules when ALTER TABLE changes the table's structure. If a validation rule contains a UDF (user-defined function), the UDF isn't evaluated and the validation rule is ignored.
OFF
Specifies that a dialog box isn't displayed before an existing file is overwritten. Note that for in-process .dll automation servers the default setting of SET SAFETY is OFF.
For the Table Designer, specifies that table or field rules, default values, and error messages are not evaluated when you save changes to a table's structure. However, data validation occurs for new or modified validation rules after you save the table structure changes.
For ALTER TABLE, table or field rules, default values, and error messages are not evaluated when ALTER TABLE changes the table's structure. Data validation does not occur for new or modified validation rules after ALTER TABLE changes the table's structure.
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询