| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 565 人关注过本帖
标题:求助,无效使用NULL的出错该如何
取消只看楼主 加入收藏
cut
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-6-6
收藏
 问题点数:0 回复次数:2 
求助,无效使用NULL的出错该如何
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
    If InStr(Node.Key, ",") = 0 Then Exit Sub
    Dim Temp
    txtSQL = ""
    Temp = Split(Node.Key, ",")
    For i = LBound(Temp) To UBound(Temp) - 1
        If XArray(i) <> "订单日期" Then
            txtSQL = txtSQL & XArray(i) & "='" & Temp(i) & "' and "
        Else
            txtSQL = txtSQL & XArray(i) & "=#" & Temp(i) & "# and "
        End If
    Next i
   
    If XArray(i) <> "订单日期" Then
        txtSQL = "SELECT 分店,订单日期,订单编号,产品名称,明细,单位数量,单位,采购数量,采购小计,备注 FROM [汇总记录$A1:J20000] WHERE " & txtSQL & XArray(i) & "='" & Temp(i) & "'"
    Else
        txtSQL = "SELECT 分店,订单日期,订单编号,产品名称,明细,单位数量,单位,采购数量,采购小计,备注 FROM [汇总记录$A1:J20000] WHERE " & txtSQL & XArray(i) & "=#" & Temp(i) & "#"
    End If
   
    RST.Open txtSQL, CNN, adOpenKeyset, adLockPessimistic
    iCount = RST.RecordCount
   
    LstvwInit
    With ListView1
        For j = UBound(Temp) + 1 To RST.Fields.Count - 1
            .ColumnHeaders.Add , , RST.Fields(j).Name, 60
        Next j
        For i = 1 To iCount
            .ListItems.Add , , RST.Fields(UBound(Temp) + 1)
            For j = UBound(Temp) + 2 To RST.Fields.Count - 1
                .ListItems(i).SubItems(j - UBound(Temp) - 1) = RST.Fields(j)  无效使用NULL
            Next j
        RST.MoveNext
        Next i
    End With
    RST.Close
End Sub
搜索更多相关主题的帖子: 如何 
2015-06-06 12:47
cut
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-6-6
收藏
得分:0 
又另一个错误了~`
订单汇总.rar (35.71 KB)
2015-06-06 13:39
cut
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-6-6
收藏
得分:0 
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
    If InStr(Node.Key, ",") = 0 Then Exit Sub
    Dim Temp
    txtSQL = ""
    Temp = Split(Node.Key, ",")
    For i = LBound(Temp) To UBound(Temp) - 1
        If XArray(i) <> "订单日期" Then
            txtSQL = txtSQL & XArray(i) & "='" & Temp(i) & "' and "
        Else
            txtSQL = txtSQL & XArray(i) & "=#" & Temp(i) & "# and "
        End If
    Next i
   
    If XArray(i) <> "订单日期" Then
        txtSQL = "SELECT 分店,订单日期,订单编号,产品名称,明细,单位数量,单位,采购数量,采购小计,备注 FROM [汇总记录$A1:J20000] WHERE " & txtSQL & XArray(i) & "='" & Temp(i) & "'"
    Else
        txtSQL = "SELECT 分店,订单日期,订单编号,产品名称,明细,单位数量,单位,采购数量,采购小计,备注 FROM [汇总记录$A1:J20000] WHERE " & txtSQL & XArray(i) & "=#" & Temp(i) & "#"
    End If
   
    RST.Open txtSQL, CNN, adOpenKeyset, adLockPessimistic  为什么订单号改动其他数字后,都出现"标准表达式中数据类型不匹配"?
    iCount = RST.RecordCount
   
    LstvwInit
    With ListView1
        For j = UBound(Temp) + 1 To RST.Fields.Count - 1
            .ColumnHeaders.Add , , RST.Fields(j).Name, 60
        Next j
        For i = 1 To iCount
            .ListItems.Add , , RST.Fields(UBound(Temp) + 1)
            For j = UBound(Temp) + 2 To RST.Fields.Count - 1
                .ListItems(i).SubItems(j - UBound(Temp) - 1) = RST.Fields(j)
            Next j
        RST.MoveNext
        Next i
    End With
    RST.Close
End Sub
2015-06-06 15:17
快速回复:求助,无效使用NULL的出错该如何
数据加载中...
 
   



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

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