|
|
发表于 12-3-2005 10:43 AM
|
显示全部楼层

请问要在 Pic 1 的第二行 Insert 空的一行应该怎么做?

请问当空的一行 Insert 后 (Pic 2),要如何改变之前的 NO.?
好像 CC6 -> 3, CK3 -> 4。。。 |
|
|
|
|
|
|
|
|
|
|
发表于 12-3-2005 12:29 PM
|
显示全部楼层
tstan135 于 12-3-2005 10:43 AM 说 :

请问要在 Pic 1 的第二行 Insert 空的一行应该怎么做?

请问当空的一行 Insert ...
因为vfp没有这样的函数,所以只好自己动手写
select database
do insbf
procedure insbf
dimension tasd(1)
currec = recno()
flag = .f.
append blank
scatter to blank
for tasc = reccount() to currec step -1
goto tasc
skip -1
flag = bof()
scatter to tasd
skip
gather from tasd
next
if flag
go top
endif
gather from blank
要注意一点DATABASE 一定要 EXCLUSIVE |
|
|
|
|
|
|
|
|
|
|
发表于 12-3-2005 02:30 PM
|
显示全部楼层
itgenius 于 12-3-2005 12:29 PM 说 :
因为vfp没有这样的函数,所以只好自己动手写
select database
do insbf
procedure insbf
dimension tasd(1)
currec = recno()
flag = .f.
append blank
scatter to blank
for tasc = reccount( ...
在 Insert 空的一行后,之前的资料却不会 Move 在下一行。 |
|
|
|
|
|
|
|
|
|
|
发表于 12-3-2005 08:03 PM
|
显示全部楼层
tstan135 于 12-3-2005 02:30 PM 说 :
在 Insert 空的一行后,之前的资料却不会 Move 在下一行。
方法一:
select database
do insbf
procedure insbf
dimension tasd(1)
currec = recno()
flag = .f.
append blank
scatter to blank
for tasc = reccount() to currec step -1
goto tasc
replace no with tasc && 在这加多这个指令
skip -1
flag = bof()
scatter to tasd
skip
gather from tasd
next
if flag
go top
endif
gather from blank
方法二:
go top
tasc = 1
do while !eof()
repl no with tasc
tasc = tasc + 1
skip
enddo
方法三:
go top
for tasc = 1 to reccount()
repl no with tasc
next
献丑了 |
|
|
|
|
|
|
|
|
|
|
发表于 13-3-2005 09:55 AM
|
显示全部楼层
在 Insert 空的一行后,之前的资料可以 Move 到下一行。
1.但如果当时没有资料,就会有 Error。
2.No. 不会改变和自动 Increase。
No.会自动 Increase,但 Insert 总是在最后一行。
No.总在地一行自动 Increase 和 Insert 总是在最后一行 |
|
|
|
|
|
|
|
|
|
|
发表于 13-3-2005 04:05 PM
|
显示全部楼层
tstan135 于 12-3-2005 10:43 AM 说 :

请问要在 Pic 1 的第二行 Insert 空的一行应该怎么做?

请问当空的一行 Insert ...
i use
select files
insert before blank
gridtest.refresh |
|
|
|
|
|
|
|
|
|
|
发表于 13-3-2005 05:25 PM
|
显示全部楼层
xiaoye 于 13-3-2005 04:05 PM 说 :
i use
select files
insert before blank
gridtest.refresh
insert before blank 很像只有在 foxpro 2.5有, 我的vfp5.0, 6.0 用不到这个指令 |
|
|
|
|
|
|
|
|
|
|
发表于 13-3-2005 05:34 PM
|
显示全部楼层
tstan135 于 13-3-2005 09:55 AM 说 :
在 Insert 空的一行后,之前的资料可以 Move 到下一行。
1.但如果当时没有资料,就会有 Error。
2.No. 不会改变和自动 Increase。
No.会自动 Increase,但 Insert 总是在最后一行。
No.总在地一行 ...
你的意思是它不会加在你的前一行?可是我用到没问题...致以no increase那个我只是直接在这里打.方法二和方法三的动作是从新算过.因为我在朋友家,所以不能试,等我回家才帮你研究研究哈哈!!
******** |
|
|
|
|
|
|
|
|
|
|
发表于 13-3-2005 09:06 PM
|
显示全部楼层
itgenius 于 13-3-2005 05:34 PM 说 :
你的意思是它不会加在你的前一行?可是我用到没问题...致以no increase那个我只是直接在这里打.方法二和方法三的动作是从新算过.因为我在朋友家,所以不能试,等我回家才帮你研究研究哈哈!!
********
1.我是说当 table 是新的,里面没有资料时才会有 error。因为 "gather from tasd " 这句 command。请问可否解决?
2.至于"no increase 那个我只是直接在这里打",那样会很麻烦。因为假设里面有 8 条资料,而你在第二行 Insert 空的一行后,那么你就必须一个个从第二行改到第九行。 |
|
|
|
|
|
|
|
|
|
|
发表于 13-3-2005 10:44 PM
|
显示全部楼层
tstan135 于 13-3-2005 09:06 PM 说 :
1.我是说当 table 是新的,里面没有资料时才会有 error。因为 "gather from tasd " 这句 command。请问可否解决?
2.至于"no increase 那个我只是直接在这里打",那样会很麻烦。因为假设里面有 ...
1.这个很简单,只要加以下的指令就行了
if eof()
append blank
return
endif
2.对,其实我写的 insbf.prg 也是从上面搬到下面,当资料多了,会比较慢.为何VFP取消INSERT BEFORE 这个指令, 大概是这样的问题吧(哈哈!!!个人认为)不懂 6.0以上做到了吗? |
|
|
|
|
|
|
|
|
|
|
发表于 14-3-2005 08:44 AM
|
显示全部楼层
NO 一定是 index field
更新后要 Thisform.Grid1.Refresh |
|
|
|
|
|
|
|
|
|
|
发表于 14-3-2005 10:17 AM
|
显示全部楼层

Insert 空的一行后,只是用"replace no with recno() all",就可以让 no 里的数字自动从 1 开始顺序 Increase。但是在表里有分很多 group,所以不可以用 "replace no with recno() all",要如何才能使它只自动改变每个 group 里 NO 的数字? |
|
|
|
|
|
|
|
|
|
|
发表于 14-3-2005 12:06 PM
|
显示全部楼层
itgenius 于 12-3-2005 08:03 PM 说 :
方法一:
select database
do insbf
procedure insbf
dimension tasd(1)
currec = recno()
flag = .f.
append blank
scatter to blank
for tasc = reccount() to currec step -1
goto ...

当我的 table set filter 后就会有 error。 |
|
|
|
|
|
|
|
|
|
|
发表于 14-3-2005 01:23 PM
|
显示全部楼层
给单一个组 Group 插入 Insert
- Select <ChildTable>
- nRec = RecNo()
- nRun = No
- xGroup = Keycode
- Insert Into <ChildTable> (Keycode,No) Values (xGroup,nRun)
- Go nRec
- Scan Rest For Keycode=xGroup
- nRun = nRun + 1
- Replace No With nRun
- EndScan
- Select <ParentTable>
复制代码
[ Last edited by 白日梦 on 14-3-2005 at 01:26 PM ] |
|
|
|
|
|
|
|
|
|
|
发表于 15-3-2005 11:57 AM
|
显示全部楼层
假设资料是 2,14PQ+R,1J,28WA,3+10J,1 。在 excel 里可以 sort 成 1,2,14PQ+R,1J,28WA,3+10J 。 请问在 foxpro 里的 index 应该怎样写,才能显示成那样?
sorry, 刚才打错。
[ Last edited by tstan135 on 15-3-2005 at 01:59 PM ] |
|
|
|
|
|
|
|
|
|
|
发表于 15-3-2005 01:50 PM
|
显示全部楼层
tstan135 于 15-3-2005 11:57 说 :
假设资料是 2,14PQ+R,1J,28WA,3+10J,1 。在 excel 里可以 sort 成 1,2,14PQ+R,1J,3+10J,28WA 。 请问在 foxpro 里的 index 应该怎样写,才能显示成那样?
我在Excel 里sort 出来的是以下 : ....
1
2
14PQ+R
1J
28WA
3+10J
VFP sorting 就 如下 :
1
2
14PQ+R
1J
3+10J
28WA
index on SUBSTR(ALLTRIM(aFieldName),5)........
[ Last edited by enry98 on 15-3-2005 at 02:02 PM ] |
|
|
|
|
|
|
|
|
|
|
发表于 15-3-2005 01:53 PM
|
显示全部楼层
|
吓!怎样都 sort 不到,无论 Excel 或 FoxPro。 |
|
|
|
|
|
|
|
|
|
|
发表于 15-3-2005 02:06 PM
|
显示全部楼层
sorry,刚才打错。
enry98 于 15-3-2005 01:50 PM 说 :
我在Excel 里sort 出来的是以下 : ....
1
2
14PQ+R
1J
28WA
3+10J
请问 foxpro 可否 sort 成这样? |
|
|
|
|
|
|
|
|
|
|
发表于 15-3-2005 02:11 PM
|
显示全部楼层
tstan135 于 15-3-2005 14:06 说 :
请问 foxpro 可否 sort 成这样?
不能 , 看我上一篇的回复..... |
|
|
|
|
|
|
|
|
|
|
发表于 15-3-2005 02:51 PM
|
显示全部楼层
enry98 于 15-3-2005 01:50 PM 说 :
VFP sorting 就 如下 :
1
2
14PQ+R
1J
3+10J
28WA
您是怎样做的?我的资料的排列是:
index on SUBSTR(ALLTRIM(keycode),5) TAG keycode
显示成
index on SUBSTR(ALLTRIM(keycode),10) TAG keycode
|
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|