我的VB.net语法错误怎么回事?

时间:2015-04-03 00:07:42

标签: sql vb.net

Form1.stockCommand.Connection = requestConnection
    Form1.stockCommand.CommandText = "Insert into UserOrders(TickerSymbol,DateTime,OrderType,StockQuantity,OrderStatus) Values('" &
        Form1.StockComboBox.Text & "','" & Date.Today & "','" & Form1.TradeTypeComboBox.Text & "','" & Form1.QuantityTextBox.Text & "','PENDING')"

    Dim numOfRecords As Integer = Form1.stockCommand.ExecuteNonQuery()
    If numOfRecords = 1 Then
        MsgBox("A new order has been added successfully")
    Else
        MsgBox("Failed to add a new order")
    End If

更具体地说,VB.NET说"未处理的类型' System.Data.OleDb.OleDbException'发生在System.Data.dll

附加信息:INSERT INTO语句中的语法错误。"

我的所有访问名称都对应于代码中的名称。

谢谢!

0 个答案:

没有答案