嗨,当我单击按钮更新数据库时,我在使用 vb.net 更新我的一个表时遇到了问题,它给了我错误“System.Data.OleDb.OleDbException:没有为一个或多个必需参数提供值。” 这是代码
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim aConnection As New OleDbConnection
Dim aCommand As New OleDbCommand
Dim SQLQuery, aConnectionString As String
Dim Text As String = TextBox1.Text
Dim aDataAdapter As New OleDbDataAdapter
Dim aDataReader As New DataSet
SQLQuery = "Update Review Set report='Yes' Where Text='" & Text & "'"
aConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("App_Data/BookReviewWebsite.accdb")
aConnection = New OleDbConnection(aConnectionString)
aConnection.Open()
aCommand = New OleDbCommand(SQLQuery, aConnection)
aCommand.ExecuteNonQuery()
Label15.Text = "Review has been reported"
aConnection.Close()
End Sub