字段列表中的未知表(vb.net中的MySQL)

时间:2013-09-15 03:14:54

标签: mysql vb.net

我使用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上,它给了我一个错误...... 它表示“未知表格'* tblItems 在字段列表中 *”甚至表格确实存在于我的数据库中......有点帮助请?

1 个答案:

答案 0 :(得分:0)

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

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