下面的代码是错误的:
“发生了'System.InvalidCastException'类型的未处理异常 在Microsoft.VisualBasic.dll
中附加信息:从字符串“SELECT Items.itm_gsm”转换, Items.itm_“键入'Long'无效。”
sql_lotitems3 = "SELECT Items.itm_gsm, Items.itm_size, LotItems.lot_itm_qty
FROM (Items
INNER JOIN LotItems ON LotItems.itm_code = Items.itm_code)
INNER JOIN LotMaster ON LotMaster.lot_code = LotItems.lot_code
WHERE LotMaster.po_number =" & ponum And "LotMaster.lot_number=" & lotnum
当我只使用WHERE子句(ponum或lotnum)中的一个条件而没有当然的操作符时,它工作正常...
答案 0 :(得分:0)
使用“And
之后
ponum
sql_lotitems3 = "SELECT Items.itm_gsm, Items.itm_size, LotItems.lot_itm_qty
FROM (Items
INNER JOIN LotItems ON LotItems.itm_code = Items.itm_code)
INNER JOIN LotMaster ON LotMaster.lot_code = LotItems.lot_code
WHERE LotMaster.po_number =" & ponum & " And LotMaster.lot_number=" & lotnum