Inserting Parameters, C#, T-Sql
- by jpavlov
I am trying to insert a parameter through an aspx page via text box. I set my parameters up, but evertime I executenonquery, the @Username shows up in the database instead of the actual value.
Below is my code. Can anyone shed a little insight?
SqlParameter @UserName = new SqlParameter("@UserName", System.Data.SqlDbType.VarChar);
@UserName.Direction = ParameterDirection.Input;
@UserName.Value = txtUserName.Text;
cmd.Parameters.Add(@UserName);