上更新查询“没有为一个或多个必需的参数给定值”我收到错误错误:从ASP.NET
No value given for one or more required parameters
当我尝试执行以下代码
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim t2 = TextBox2.Text
Dim dbcmd As OleDbCommand
dbcmd = New OleDbCommand("UPDATE login1 SET height ='" + TextBox2.Text + "' WHERE username =" + str, dbcon) //This is the part where the error is ....
dbcon.Open()
dbcmd.ExecuteNonQuery()
dbcon.Close()
End Sub
End Class
我我们试图在这个语句中进行更改,如使用不同的参数方法......但所有的代码都显示了相同的错误。
我敢打赌,问题是,你正在使用的输入中有一个参数占位符。因此,你面临的问题是你的代码对于SQL注入来说是非常开放的。您需要使用SQL参数将用户输入视为* data *,而不是视为***可执行代码***。 – David