| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 432 人关注过本帖
标题:插入不重復的資料
只看楼主 加入收藏
jxyga111
Rank: 8Rank: 8
来 自:中華人民共和國
等 级:贵宾
威 望:33
帖 子:6015
专家分:895
注 册:2008-3-21
结帖率:70%
收藏
 问题点数:0 回复次数:0 
插入不重復的資料
Dim x As String
Dim date11 As Date
Dim cn As New Connection
Dim objrs2 As New Recordset

    x = Format(DTP1.Value, "yyyymmdd") & "至" & Format(DTP2.Value, "yyyymmdd")
    date11 = DTP1.Value
   
    cn.Execute "DELETE from t_a where td013 between'" & Format(DTP1.Value, "yyyymmdd") & "' And '" & Format(DTP2.Value, "yyyymmdd") & "'"
   
    For a = 0 To weeks - 1
        tempdate = DateAdd("ww", a, date1) + 6
        k = "insert into t_a select tda=" & a + 1 & ",date1='" & x & "',TD008,SUM(TD008),bhd=0,maxqty=0,remark='',td013=TD013 from COPTD where  TD013 between '" & Format(DTP1.Value, "yyyymmdd") & "' AND '" & Format(DTP2.Value, "yyyymmdd") & "'group by TD008,TD013"
        cn.Execute k
    Next
    For q = 0 To a
        Set objrs2 = Nothing
        objrs2.CursorLocation = adUseClient
        If a = q Then
            Set objrs = Nothing
            objrs2.Open "select distinct tda,date1,count(td0081),td008,bhd=sum(td008)/625,maxqty,remark,td013 from t_a    where td013 BETWEEN '" & Format(DTP1.Value, "yyyymmdd") & "'  and  '" & Format(DTP2.Value, "yyyymmdd") & "'  group by tda,date1,td008,maxqty,remark,td013", cn, 3, 2
        End If
    Next
由於要將第幾周寫入進去,望高手調試,指教一下
2008-08-09 08:58
快速回复:插入不重復的資料
数据加载中...
 
   



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

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