没有给出一个或多个必需参数的值。 asp.net

时间:2013-07-29 13:15:49

标签: asp.net parameters oledb

我遇到错误:没有给出一个或多个必需参数的值。单击“输入”按钮时

 Protected Sub btnOrder_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOrder.Click


    Dim rentid As String = txtRentID.Text
    Dim memberid As String = lblMemberID.Text
    Dim items2 As String = DropDownList1.Text
    Dim date2 As Date = lblDate.Text
    Dim qty2 As Integer = CInt(txtQty.Text)
    Try
        Dim dbconn1, dbcomm1, dbex1, sql1
        dbconn1 = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("~/App_Data/aspDB.mdb"))
        dbconn1.open()
        sql1 = "Insert into [Order] VALUES ( " & "'" & rentid & "'" & "," & "'" & qty2 & "'" & "," & "'" & date2 & "'" & "," & "'" & memberid & "'" & "," & items2 & ")"
        dbcomm1 = New OleDbCommand(sql1, dbconn1)
        dbex1 = dbcomm1.executenonquery
        lblOut.Text = "saved"
        dbconn1.Close()
    Catch ex As Exception
        lblOut.Text = ex.Message
    End Try


End Sub

有没有丢失的代码?谢谢你的帮助

0 个答案:

没有答案