我正在写一个简单的更新密码页面(学习目的)。该页面包含两个文本框控件,允许用户输入新密码,然后通过将密码输入第二个文本框控件来确认密码,最后单击提交底部以更新存储在表中的密码一个数据库。我的问题是单击按钮时收到以下错误:初始化字符串的格式不符合从索引 0 开始的规范错误。
这是按钮后面的代码:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox2.Text = TextBox3.Text Then
Dim myConnectionString As String
myConnectionString = "myDbIIConnectionString1"
Dim myConnection As New SqlConnection(myConnectionString)
myConnection.Open()
Dim mySQLQuery As String
mySQLQuery = "UPDATE myTb SET password VALUES (@password)"
Dim myCommand As New SqlCommand(mySQLQuery, myConnection)
myCommand.Parameters.AddWithValue("@password", TextBox3.Text)
myCommand.Connection = myConnection
myCommand.ExecuteNonQuery()
myCommand = Nothing
myConnection.Close()
myConnection = Nothing
Label2.Text = "Your Password has been changed"
Else
Label2.Text = "Retype your Password"
End If
Response.Redirect("login.aspx")
End Sub
有人可以帮助我了解我在这里缺少什么吗?谢谢你