我的程序有问题。它说"附加信息:标准表达式中的数据类型不匹配。"错误是扔到rs.Fill(dt)
这里是我的代码
con.Open()
Dim dt As New DataTable("tbl_Stock")
Dim rs As New OleDb.OleDbDataAdapter("Select * from [tbl_Stocks] WHERE [Product] ='" & lbPro.Text & "' AND [Batch ID] = '" & txtID.Text & "'", con)
Dim ve As String
rs.Fill(dt)
ve = CStr(dt.Rows.Count)
rs.Dispose()
con.Close()
答案 0 :(得分:0)
很可能,批次ID 是数字,因此没有引号:
Dim rs As New OleDb.OleDbDataAdapter("Select * from [tbl_Stocks] WHERE [Product] ='" & lbPro.Text & "' AND [Batch ID] = " & txtID.Text & "", con)