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)
当我使用messagebox测试它时......
MsgBox(DataTable1.Rows.Count)
它只返回一行......但是当我将commandText粘贴到PhpMyAdmin SQL并运行它时,它会显示完整的5行。请给我一点帮助......谢谢!
我使用MS VisualStudio2012