我的代码会有什么问题?我遇到错误 AddWithValue 不是 MySql.Data.MySqlClient.MySqlParameter 的成员
这是我的代码:
Dim bn As String = ""
Dim bottles As Integer = 0
Dim SQLStatement As String = "UPDATE patient SET number_of_bottles = @bottles WHERE bednumber = @bednumber"
Using cnn As New MySqlConnection("Server=localhost; database=patientinfo;user id=root;password=")
Dim cmdn As New MySqlCommand(SQLStatement, cnn)
cmdn.Parameters.AddWithValue("bottles", bottles)
cmdn.Parameters.AddWithValue("bednumber", bn)
cnn.Open()
cmd.ExecuteNonQuery()
End Using
我是 VB.net 和 MySql 的新手。任何帮助,将不胜感激。谢谢 ! :)
最佳答案
您必须使用在参数中使用的名称(缺少 @
符号):
cmdn.Parameters.AddWithValue("@bottles", bottles)
cmdn.Parameters.AddWithValue("@bednumber", bn)
关于mysql - AddWithValue 不是 MySql.Data.MySqlClient.MySqlParameter VB.net 的成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11940383/