在listview数据中显示错误添加时间请帮帮我... [英] Error showing in listview data add time please help me...

查看:58
本文介绍了在listview数据中显示错误添加时间请帮帮我...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

listview数据显示的一些错误增加时间请帮助我...

请帮助我

错误 - imgbb.com [ ^ ]





001 - imgbb.com [ ^ ]



我有什么试过:



Some error showing in listview data add time please help me...
Please help me
Error — imgbb.com[^]


001 — imgbb.com[^]

What I have tried:

Public Sub Displayitemrpt1()
        If cn.State = ConnectionState.Open Then
            cn.Close()
        End If
        cn.Open()
        Dim cmd As New OleDb.OleDbCommand("SELECT * FROM pur_invdet, item WHERE pur_invdet.ItemID=item.itemid and purinvid BETWEEN '" & TextBox1.Text & " And " & TextBox1.Text & "'  ORDER BY slno  ", cn)
        Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader()
        ListView1.Items.Clear()
        Do While dr.Read()
            Dim new_item As New  _
                     ListViewItem(dr.Item("slno").ToString)
            new_item.SubItems.Add(dr.Item("itmcod").ToString)
            new_item.SubItems.Add(dr.Item("itemnm").ToString)
            new_item.SubItems.Add(dr.Item("catid").ToString)
            new_item.SubItems.Add(dr.Item("Qty").ToString)
            new_item.SubItems.Add(dr.Item("MRP").ToString)
            new_item.SubItems.Add(dr.Item("Rate").ToString)
            new_item.SubItems.Add(dr.Item("dis").ToString)
            new_item.SubItems.Add(dr.Item("tax").ToString)
            new_item.SubItems.Add(dr.Item("TaxableAmt").ToString)
            new_item.SubItems.Add(dr.Item("taxnetamt").ToString)
            new_item.SubItems.Add(dr.Item("Amount").ToString)
            new_item.SubItems.Add(dr.Item("ItemID").ToString)
            ListView1.Items.Add(new_item)
        Loop
        cn.Close()
    End Sub

推荐答案

只需在您的问题中添加错误消息,而不是提供图片链接。



错误信息非常明确:

在没有和在查询表达式中的运算符之间



所以你的问题有问题附近的SQL语句:

Instead of providing links to images just add the error message to your question.

That error message is quite clear:
"Between operator without And in query expression"

So there is something wrong with your SQL statement near And:
SELECT * FROM pur_invdet, item WHERE pur_invdet.ItemID=item.itemid and purinvid BETWEEN '" & TextBox1.Text & " And " & TextBox1.Text & "'  ORDER BY slno  "

周围缺少单引号:

There are missing single quotes around And:

SELECT * FROM pur_invdet, item WHERE pur_invdet.ItemID=item.itemid and purinvid BETWEEN '" & TextBox1.Text & "' And '" & TextBox1.Text & "'  ORDER BY slno  "



似乎还有另一个错误:您将相同的值传递给 BETWEEN 参数( TextBox1.Text ),这样使用 BETWEEN 就没用了。我猜第二个参数应该是 TextBox2.Text 。要避免此类错误,请使用更好的变量名称,例如 TextBoxStartId TextBoxEndId


There seems to be another mistake: You are passing the same value to the BETWEEN parameters (TextBox1.Text) so that using BETWEEN is useless. I guess the second parameter should be something like TextBox2.Text. To avoid such errors use better variable names like TextBoxStartId and TextBoxEndId.


这篇关于在listview数据中显示错误添加时间请帮帮我...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆