查看: 1838|回复: 27
|
[问]fox pro PROGRAM问题
[复制链接]
|
|
怎样告诉FOXPRO 两个TABLE的FIELD是一样的(名字不一样)
例
TABLE A FIELD
CT_CUS, PART,ct_mod,
TABLE B FIELD
CUST,PART,model
program
USE TABLE A
APPEND FROM TABLE B
问题
怎样告诉FOXPRO
table a ct_cus =table b cust
table a ct_mod =table b model
(foxpro 2.6a)
[ Last edited by samm4u on 29-6-2005 at 11:40 AM ] |
|
|
|
|
|
|
|
发表于 30-6-2005 01:23 AM
|
显示全部楼层
USE tablea IN SELECT(1) AGAIN
USE tableb IN SELECT(1) AGAIN
SELECT tableA
SCAN
SCATTER TO arrData
SELECT tableb
APPEND FROM ARRAY arrData
ENDSCAN
SELECT tableA
BROWSE
USE
SELECT tableB
BROWSE
USE |
|
|
|
|
|
|
|
楼主 |
发表于 30-6-2005 10:41 AM
|
显示全部楼层
谢谢 解决了
加问:
如果不同 STRUCTURE 呢?
例:
TABLE A FIELD
CT_CUS, PART,ct_mod,
TABLE B FIELD
CUST ID,CUST,ADDRESS,PART,model,QTY |
|
|
|
|
|
|
|
楼主 |
发表于 30-6-2005 11:21 AM
|
显示全部楼层
还有
要怎样告诉FOXPRO 找出两笔一样的DATA呢
例:
database
cust |part |model
1 abc |123 |123
2 cde |345 |345
3 efg |135 |135
4 abc |123 |123
怎样 找出 1 和 4 是一样的
[ Last edited by samm4u on 30-6-2005 at 11:23 AM ] |
|
|
|
|
|
|
|
发表于 1-7-2005 01:53 AM
|
显示全部楼层
samm4u 于 30-6-2005 10:41 AM 说 :
谢谢 解决了
加问:
如果不同 STRUCTURE 呢?
例:
TABLE A FIELD
CT_CUS, PART,ct_mod,
TABLE B FIELD
CUST ID,CUST,ADDRESS,PART,model,QTY
SCATTER TO arrData FIELDS CT_CUS, PART
APPEND FROM ARRAY arrData FIELDS cust, part |
|
|
|
|
|
|
|
发表于 1-7-2005 01:56 AM
|
显示全部楼层
samm4u 于 30-6-2005 11:21 AM 说 :
还有
要怎样告诉FOXPRO 找出两笔一样的DATA呢
例:
database
cust |part |model
1 abc |123 |123
2 cde |345 |345
3 efg |135 |135
4 ab ...
SELECT CUST, COUNT(CUST) FROM TABLEC GROUP BY CUST
ABC 2
CDE 1
EFG 1 |
|
|
|
|
|
|
|
楼主 |
发表于 4-7-2005 04:06 PM
|
显示全部楼层
要怎样APPEND TO EXCEL FILE 呢
要怎样APPEND FOXPRO DATA TO EXCEL 呢
例:
TEMPSTK.DBF
DATE | STK_IN |STK_OUT |
04/07/2005| 5000 |
"" | | 50000
EXCEL
FILE :STK.XLS
SHEET : STK
DATE | STK_IN | STK_OUT |
02/07/2005 | 282 | |
03/07/2005 | | 2500 |
怎样APPEND FROM TEMPSTK.DBF TO STK.XLS
[ Last edited by samm4u on 4-7-2005 at 04:11 PM ] |
|
|
|
|
|
|
|
发表于 4-7-2005 10:41 PM
|
显示全部楼层
好像没有直接的方法。。。如果不用 active x 的话,我想
import from xls
然后再
export to xls |
|
|
|
|
|
|
|
楼主 |
发表于 5-7-2005 07:46 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 5-7-2005 08:50 AM
|
显示全部楼层
VFP9 的指令 TABLE1.DBF -> TABLE1.XLS
USE TABLE1
EXPORT TO TABLE1 TYPE XLS ALL |
|
|
|
|
|
|
|
楼主 |
发表于 5-7-2005 04:27 PM
|
显示全部楼层
要怎样QUERY 2 DATABASE 后加FIELD
例:
PART.DBF FIELD
PARTNO ,MODEL
STK.DBF FIELD
PART,STK OUT,STK_IN
CODE::::
SELECT DISTINCT STK.PART,STK.MODEL,STK.IN,STK.OUT;
FROM STK, PART;
WHERE PART.PART = STK.PART;
INTO TABLE TEMPSTK.DBF
如果要加一个FIELD在STK_IN前NAME
TOTAL_STK
和TOTAL_STK 的VALUE
TOTAL_STK = STK_IN - STK_OUT
本来这样
PART|MODEL|STK_IN|STK_OUT|
ABC |abc | 2500 |2000 |
变成这样
PART|MODEL|TOTAL|STK_IN|STK_OUT|
ABC |abc | 500 | 2500 |2000 | |
|
|
|
|
|
|
|
楼主 |
发表于 5-7-2005 04:47 PM
|
显示全部楼层
REPLACE 的问题
例:
STK.DBF FIELD
PART |STK OUT|STK_IN
ABC| |2500
BCD|1200 |1500
CED| |250
要怎样找 到 ABC
和 REPLACE STK_OUT: 2000 呢?
这样
PART |STK OUT|STK_IN
ABC|2000 |2500
BCD|1200 |1500
CED| |250
[ Last edited by samm4u on 5-7-2005 at 04:49 PM ] |
|
|
|
|
|
|
|
发表于 5-7-2005 10:56 PM
|
显示全部楼层
samm4u 于 5-7-2005 04:27 PM 说 :
例:
PART.DBF FIELD
PARTNO ,MODEL
STK.DBF FIELD
PART,STK OUT,STK_IN
CODE::::
SELECT DISTINCT STK.PART,STK.MODEL,STK.IN,STK. ...
SELECT DISTINCT stk.part, stk.model, stk_in - stk_out as total, stk.stk_in,
stk.stk_out FROM stk, part WHERE part.partno = stk.part |
|
|
|
|
|
|
|
发表于 5-7-2005 11:01 PM
|
显示全部楼层
samm4u 于 5-7-2005 04:47 PM 说 :
例:
STK.DBF FIELD
PART |STK OUT|STK_IN
ABC| |2500
BCD|1200 |1500
CED| |250
要怎样找 到 ABC
和 REPLACE STK ...
UPDATE stk set stk_out = 2000 WHERE part='abc'
你可以安装一些 sql tools 来看看如何使用 sql |
|
|
|
|
|
|
|
楼主 |
发表于 6-7-2005 07:52 AM
|
显示全部楼层
安装 sql tools 有些什么条件
最低硬体要求?
OS?
那一个SQL PROGRAM 免费又好用? |
|
|
|
|
|
|
|
楼主 |
发表于 6-7-2005 05:19 PM
|
显示全部楼层
有什么问题
select 0
use tempitn
select 0
use itn
scan
select 1
scatter to arrData fields ITN_REFNO,TRAVEL_NO,PART_NO,MODEL
select 2
update on serial from itn_refno
replace int with TRAVEL_NO
replace part with PART_NO
replace model with model
replace pun_date with post_date
endscan
我想要找到INT 的serial =itn_refno
然后而UPDATE int with TRAVEL_NO
part with PART_NO
model with model
(有很多FIELD 只是想UPDATE 这三笔) |
|
|
|
|
|
|
|
发表于 6-7-2005 08:55 PM
|
显示全部楼层
samm4u 于 6-7-2005 07:52 AM 说 :
安装 sql tools 有些什么条件
最低硬体要求?
OS?
那一个SQL PROGRAM 免费又好用?
microsoft access, visual foxpro, phpmyadmin |
|
|
|
|
|
|
|
发表于 6-7-2005 09:04 PM
|
显示全部楼层
可以考虑 select 你想要的资料去 tmp cursor,
然后从 tmp cursor 去 update |
|
|
|
|
|
|
|
发表于 6-7-2005 09:06 PM
|
显示全部楼层
samm4u 于 6-7-2005 05:19 PM 说 :
select 0
use tempitn
select 0
use itn
scan
select 1
scatter to arrData fields ITN_REFNO,TRAVEL_NO,PART_NO,MODEL
select 2
update on serial from itn_refno
replace ...
我个人觉得用 select 1, select 2 不太好,
可以考虑使用 select itn, select tempitn,比较好读。 |
|
|
|
|
|
|
|
楼主 |
发表于 7-7-2005 04:07 PM
|
显示全部楼层
use tempitn
use itn
scan
select
scatter to arrData fields ITN_REFNO,TRAVEL_NO,PART_NO,MODEL
select 2
locate serial = itn_refno
if found()
replace int with TRAVEL_NO
replace part with PART_NO
replace model with model
replace pun_date with post_date
endif
endscan
为什么不能REPLACE? |
|
|
|
|
|
|
| |
本周最热论坛帖子
|