我使用MySql.Data.MySqlClient.MySqlCommand和MySqlConnection

Public fillGridCmdTxt As String = "SELECT tblItems.part_num AS Part#, tblCategory.category_description AS Category, " _
            & " tblItems.item_name AS 'Item Name', tblItems.item_desc AS Description, " _
            & "tblItems.item_qty AS Qty, tblUnit.unit_name AS Unit, tblItems.item_price AS 'Selling Price(Php)' " _
            & "FROM tblUnit INNER JOIN tblItems ON tblUnit.unit_id = tblItems.unit_id INNER JOIN tblCategory " _
            & "ON tblItems.category_id = tblCategory.category_id "


当我使用executeNonQuery
在MySqlCommand上,它给我一个错误...
它说“ Unkown table'* tblItems in field list *”甚至该表确实存在于我的数据库中……请帮忙一下吗?

最佳答案

您需要在引号之间加上Part#

#符号在MySQL中开始注释,因此您的整个语句将被读取为SELECT tblItems.part_num AS Part。错误消息告诉您,您正在未在FROM列表中指定的字段列表中命名一个表(因为FROM列表已被注释掉)。

关于mysql - 字段列表中的未知表(vb.net中的MySQL),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18808586/

10-09 21:55