B
bbawa1
I have the following code but when I build this it gives me errors
that username, userpass, userfname does not exist in current context.
I don't know where is the problem and how can I fix this.
SqlConnection objConn = new SqlConnection("Data
Source=sql1300.mssqlservers.com;Initial Catalog=twcsan;Persist
Security Info=True;User ID=twcsan;Password=mln0531");
SqlCommand objCmd = new SqlCommand("UPDATE tbUsers SET
MyName = @username, " +
"MyPass = @userPass, " +
"UserFName = @userfname, " +
"WHERE UserId = 10", objConn);
objConn.Open();
objCmd.Parameters.AddWithValue(@username1, TextBox1.Text);
objCmd.Parameters.AddWithValue(@userPass,
this.TextBox2.Text);
objCmd.Parameters.AddWithValue(@userfname,
this.TextBox3.Text);
objCmd.ExecuteNonQuery();
objConn.Close();
Thanks in advance
that username, userpass, userfname does not exist in current context.
I don't know where is the problem and how can I fix this.
SqlConnection objConn = new SqlConnection("Data
Source=sql1300.mssqlservers.com;Initial Catalog=twcsan;Persist
Security Info=True;User ID=twcsan;Password=mln0531");
SqlCommand objCmd = new SqlCommand("UPDATE tbUsers SET
MyName = @username, " +
"MyPass = @userPass, " +
"UserFName = @userfname, " +
"WHERE UserId = 10", objConn);
objConn.Open();
objCmd.Parameters.AddWithValue(@username1, TextBox1.Text);
objCmd.Parameters.AddWithValue(@userPass,
this.TextBox2.Text);
objCmd.Parameters.AddWithValue(@userfname,
this.TextBox3.Text);
objCmd.ExecuteNonQuery();
objConn.Close();
Thanks in advance