Hello. I am trying to have my code update a database table. I want to create a parameter based on the value of label 3 and I am not exactly sure what I am doing wrong.
Basically I want to use username as a parameter and I want username to always equal label3.text
Any help would be greatly appreciated.
Protected Sub ChangePasswordPushButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim username As String
username = Label3.Text
Dim dbcon2 As New SqlConnection("Data Source=db_server;Initial Catalog=StatementWeb;User ID=steve;Password=stephen")
Dim dbcmd2 As New SqlCommand
dbcmd2.Connection = dbcon2
dbcmd2.CommandText = "update [userinfo] set [pwchange]='No' WHERE ([UserName] = @username)"
Dim Value2 As String = dbcmd2.ExecuteScalar()