当我加载时必须有多行时, DataTable只返回一行:
Dim comm As New MySqlCommand
Dim conn As New MySqlConnection
With comm
.CommandText = "SELECT tblSupplierPO.supplier_POID, tblSupplier.supplier_name, tblSupplierPO.supplier_PODate, tblCategory.category_description, tblSupplierPOList.part_num, tblSupplierPOList.item_name, tblSupplierPOList.order_qty, tblUnit.unit_name FROM tblSupplierPO INNER JOIN tblSupplierPOList ON tblSupplierPO.supplier_POID = tblSupplierPOList.supplier_POID INNER JOIN tblSupplier ON tblSupplierPO.supplier_id = tblSupplier.supplier_id INNER JOIN tblUnit ON tblSupplierPOList.unit_id = tblUnit.unit_id INNER JOIN tblCategory ON tblSupplierPOList.category_id = tblCategory.category_id WHERE tblSupplierPOList.supplier_POID LIKE 'po-1010'"
.connection = conn
.ExecuteNonQuery
End With
然后将其加载到我的 DataTable ...
DataTable1.Load(comm.ExecuteReader)
当我使用消息框测试它时......
MsgBox(DataTable1.Rows.Count)
它只返回一行...但是当我将 commandText 复制粘贴到 PhpMyAdmin SQL 并运行它时,它显示了完整的 5 行。请在这里提供一点帮助...谢谢!
我使用 MS VisualStudio2012