Asp.net SQL Server中的插入语句

Asp.net SQL Server中的插入语句,asp.net,sql-server,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,@rati

在我的插入中是否有任何问题,因为它在“@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

查询中缺少结束符

试试这个:

INSERT INTO Feedback VALUES(@Comment, @BuyerID,@SellerID,@rating)
使用
@rating)”)
,顺便说一句,最好同时命名要插入的列。