I have this method that returns a user:
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandT ype = CommandType.Sto redProcedure;
sqlCmd.CommandT ext = "SP_Login";
SqlParameter paramEmail = new SqlParameter("@ Email",SqlDbTyp e.VarChar,60);
paramEmail.Dire ction = ParameterDirect ion.Input;
paramEmail.Valu e = strEmail.Trim() ;
sqlCmd.Paramete rs.Add(paramEma il);
SqlParameter paramPassword = new SqlParameter("@ Password",SqlDb Type.VarChar,10 0);
paramPassword .Direction = ParameterDirect ion.Input;
paramPassword .Value = strPassword.Tri m();
sqlCmd.Paramete rs.Add(paramPas sword );
sqlCmd.Connecti on = objConn.SQLConn ;
SqlDataReader drUser = sqlCmd.ExecuteR eader();
return (string) drUser[0]
BUT, it's going to the catch and throwing this error: Input string was not in a correct format.
The procedure is ok, I'm running in QueryAnalyser and everything is working, but in my application...n ot!
Could someone please help me ?
Thanks in Advance
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandT ype = CommandType.Sto redProcedure;
sqlCmd.CommandT ext = "SP_Login";
SqlParameter paramEmail = new SqlParameter("@ Email",SqlDbTyp e.VarChar,60);
paramEmail.Dire ction = ParameterDirect ion.Input;
paramEmail.Valu e = strEmail.Trim() ;
sqlCmd.Paramete rs.Add(paramEma il);
SqlParameter paramPassword = new SqlParameter("@ Password",SqlDb Type.VarChar,10 0);
paramPassword .Direction = ParameterDirect ion.Input;
paramPassword .Value = strPassword.Tri m();
sqlCmd.Paramete rs.Add(paramPas sword );
sqlCmd.Connecti on = objConn.SQLConn ;
SqlDataReader drUser = sqlCmd.ExecuteR eader();
return (string) drUser[0]
BUT, it's going to the catch and throwing this error: Input string was not in a correct format.
The procedure is ok, I'm running in QueryAnalyser and everything is working, but in my application...n ot!
Could someone please help me ?
Thanks in Advance