Inserting Parameters, C#, T-Sql
        Posted  
        
            by 
                jpavlov
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jpavlov
        
        
        
        Published on 2011-01-16T01:45:24Z
        Indexed on 
            2011/01/16
            1:53 UTC
        
        
        Read the original article
        Hit count: 590
        
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);
© Stack Overflow or respective owner