| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4668 人关注过本帖
标题:如何给临时表追加两条记录
只看楼主 加入收藏
lovelov330
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2016-7-28
结帖率:83.33%
收藏
已结贴  问题点数:20 回复次数:13 
如何给临时表追加两条记录
我用的版本是VFP6,  通过create cursor 创建的表,想给这个表追加两条记录,我该怎么操作呢!

追加的时候就APPEND BLANK 吗,然后要tableupdate() 吗?

还是append blank 后,追加完再tableupdate()呢,

麻烦大家来!
搜索更多相关主题的帖子: blank create cursor 记录 如何 
2016-10-12 08:52
Director_lbw
Rank: 2
来 自:河南安阳
等 级:论坛游民
威 望:1
帖 子:27
专家分:37
注 册:2015-1-6
收藏
得分:20 
用APPEND BLANK 就可以了,只是临时表关闭后就不保存了用不用tableupdate() 还有用吗?

只要行动,一切皆有可能
2016-10-12 09:08
lovelov330
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2016-7-28
收藏
得分:0 
回复 2楼 Director_lbw
是每追加一次,就APPEND BLANK 吗?
还是
2016-10-12 09:10
lovelov330
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2016-7-28
收藏
得分:0 
但我的不对啊,我用FOR循环增加了一条记录, 再用FOR循环增加的时候,志显示后面一个FOR循环的记录,前面一个的就没显示,这是为什么啊!!!
2016-10-12 09:18
厨师王德榜
Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18
等 级:贵宾
威 望:199
帖 子:987
专家分:4946
注 册:2013-2-16
收藏
得分:0 
可以用 Insert into 表名 (字段列表……) values (值列表……) 这个比 Append blank 再一个个去改要高效些。
2016-10-12 09:34
Director_lbw
Rank: 2
来 自:河南安阳
等 级:论坛游民
威 望:1
帖 子:27
专家分:37
注 册:2015-1-6
收藏
得分:0 
怎么会前的记录没有了呢?只要不关闭表所有的修改、删除、追加的记录都不会有变化的,我用FOR循环试过了,先追加了10条后,又追加了10是20条啊,没有丢失前的记录信息

只要行动,一切皆有可能
2016-10-12 10:02
lovelov330
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2016-7-28
收藏
得分:0 
那么用insert into  插入完,后面要在修改的话怎么做啊, 是UPDATE 呢还是REPLACE   with  

如果要用REPLACE 。。  with 。。  如何做呢!!!


麻烦了!
2016-10-12 10:21
lovelov330
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2016-7-28
收藏
得分:0 
下面是我的代码,乱码的部分是繁体汉字,这样经过FOR循环后,本来要显示两条记录,但是只显示最后一条记录!麻烦帮我看看那里出错了,实在是找不到了!
LOCAL  x, a, b, i, tf, la, kong, m, production , dattotle , totlenum, yearnum, monthnum, worknum,kong,c1year,c2month,c3day,c4,c5,rq
 SELECT ("TPAGE4")
 tf = 100
 i = 0
 x = 0
 la = 0
  kong= space(0)
 SELECT ("TPAGE3")
 i = reccount()
 totlenum = 0
 yearnum = 0
 monthnum = 0
 FOR x = 1 TO i
    SELECT ("TPAGE3")
    GOTO x
    IF kong<>alltrim(tpage3.s2)   
       tf = 0
       la = 0
       b  = 0
       c1year = 0
       c2month = 0
       c3day = 0
       c4 = 0
       c5 = 0
       worknum = 0
       yearnum = year(tpage3.s11)
       messagebox(tpage3.s2,str(yearnum))
       monthnum = month(tpage3.s11)
       messagebox(tpage3.s2,str(monthnum))
       SELECT * FROM jpcorp!?紅︽ㄆ句 WHERE ?紅︽ㄆ句.??=yearnum AND ?紅︽ㄆ句.る?=monthnum INTO CURSOR TEMP
       select temp
       dattotle = reccount()
       USE IN temp           
         if!used("?紅︽ㄆ句")
            USE d:\jpcorp\data\?紅︽ㄆ句
           else
          select ?紅︽ㄆ句
           messagebox("","匡拒??紅︽ㄆ菌")
            endif
       set order to ?るら
       rq = alltrim(str(year(tpage3.s11)))+"/"+alltrim(str(month(tpage3.s11)))+"/"+alltrim(str(day(tpage3.s11)))    ?     
       IF seek(rq)
          la = recno()
       ELSE
           messagebox("禬??紅︽ㄆ句戈?郎?絛瞅, ╰参礚猭璸衡,叫?絋﹚龄!")
          EXIT
       ENDIF
       SELECT ("TPAGE3")
        c3day= day(tpage3.s11)
       totlenum = tpage3.s6
    ELSE
       exit
       totlenum = tpage3.s6
    ENDIF         
    SELECT ("TPAGE4")
    APPEND BLANK
    REPLACE tpage4.s3 WITH  totlenum           
    REPLACE tpage4.s2 WITH  tpage3.s5   
    REPLACE tpage4.s1 WITH   tpage3.s4
    REPLACE tpage4.s35 WITH  tpage3.s1   
    DO WHILE totlenum>0
       select ?紅︽ㄆ句
       GOTO la
       worknum = iif(alltrim(?紅︽ㄆ句.痁?)=="そヰ", 0, iif(alltrim(?紅︽ㄆ句.痁?)=="?痁", 1, 2))
        c1year = ?紅︽ㄆ句.??
        c2month = ?紅︽ㄆ句.る?
        c3day= ?紅︽ㄆ句.ら戳
       SELECT ("TPAGE4")
      
       REPLACE tpage4.s36 WITH c1year
       REPLACE tpage4.s37 WITH c2month      
       SELECT * FROM TPAGE7 WHERE alltrim(tpage7.s1)=alltrim(tpage3.s5) INTO CURSOR TEMP99
       IF reccount()==0
          = messagebox("тぃ??  "+alltrim(tpage3.s5)+"  ?戈?, ╰参盢氨ゎ箇︳")
          EXIT
       ELSE
          production = iif(worknum==0, 0, iif(worknum==1, temp99.s2, temp99.s3))
       ENDIF
       IF int(production*1.05 )>=totlenum .AND. totlenum>=production
          thisform.a41.f5(c3day, totlenum)
          totlenum = 0    ?
           la=la+1
          tf = 0
       ELSE
          IF tf=0
             IF totlenum>=production
                thisform.a41.f5(c3day, production)
                totlenum = totlenum-production
                 la=la+1
                tf = 0
             ELSE
                thisform.a41.f5(c3day, totlenum)
                tf = 100-int((totlenum/production)*100)
                totlenum = totlenum-totlenum
                 tf= tf+0
                 la=la+0
             ENDIF
          ELSE
             IF totlenum>=int((production*tf)/100)
                thisform.a41.f5(c3day, int((production*tf)/100))
                totlenum = totlenum-int((production*tf)/100)
                 la=la+1
                tf = 0
             ELSE
                thisform.a41.f5(c3day, totlenum)
                b = 100-int((totlenum/int((production*tf)/100))*100)
                totlenum = totlenum-totlenum
                tf =tf -b
                 la=la+0
             ENDIF
          ENDIF
       ENDIF
    ENDDO
    endfor
 SELECT ("TPAGE4")
 tableupdate()
 SELECT ("TPAGE4")
 GOTO TOP
 RELEASE WINDOW


2016-10-12 10:31
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
收藏
得分:0 
以下是引用lovelov330在2016-10-12 10:21:59的发言:

那么用insert into  插入完,后面要在修改的话怎么做啊, 是UPDATE 呢还是REPLACE   with  

如果要用REPLACE 。。  with 。。  如何做呢!!!


麻烦了!
在SELECT...INTO CURSOR TEMP 后加readwrite,就可以用REPLACE 。。  with 。。  
2016-10-12 10:42
lovelov330
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2016-7-28
收藏
得分:0 
回复 9楼 tlliqi
上面的代码是我发的,就是这里的代码出错了,能帮忙看下这里是不是有问题啊!!
你说的那个我试试!
2016-10-12 11:00
快速回复:如何给临时表追加两条记录
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015970 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved