插入语句SQL Server

时间:2014-03-02 11:20:39

标签: asp.net sql-server

我的插入是否有任何问题,因为它在'@rating'附近说错误的语法,你可以帮我找到错误,因为我试着找不到它。

    If Page.IsValid = True Then
        Dim con1 As New SqlConnection(_start)
        con1.Open()
        Dim cmd As New SqlCommand("INSERT INTO Feedback VALUES(@Comment, @BuyerID,@SellerID,@rating")
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@Comment", UserComment.Content)
        cmd.Parameters.AddWithValue("@BuyerID", buyerid)
        cmd.Parameters.AddWithValue("@SellerID", sellerid)
        cmd.Parameters.AddWithValue("@rating", Rating.SelectedValue)
        cmd.Connection = con1

        cmd.ExecuteNonQuery()
    End If

1 个答案:

答案 0 :(得分:1)

您错过了查询中的结束)

试试这个:

INSERT INTO Feedback VALUES(@Comment, @BuyerID,@SellerID,@rating)