当加载时必须有多行时,数据表只返回一行:

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

然后将此加载到我的数据表。。。
DataTable1.Load(comm.ExecuteReader)

当我使用messagebox测试时。。。
MsgBox(DataTable1.Rows.Count)

它只返回一行。。。但是当我将commandText复制粘贴到PhpMyAdmin SQL并运行它时,它显示了完整的5行。请帮个忙。。。谢谢!
我用的是微软VisualStudio2012

最佳答案

使用MySqlDataAdapterFill您的DataTable

10-08 14:29