> public int GetMemberIdByEmail(string email)
> {
> SqlParameter[] aryParams = new SqlParameter[2];
>
> aryParams[0] = new SqlParameter("@Email", email);
> aryParams[1] = new SqlParameter("@ID", SqlDbType.Int);
> aryParams[1].Direction = ParameterDirection.Output;
>
> SqlHelper.ExecuteNonQuery(_Connection, "GetMemberIDByEmail", aryParams);
> if (aryParams[1].Value == null)
> {
> Debug.WriteLine("Still NULL!"); <-- ALWAYS GET THIS!!
> }
> else
> {
> Debug.WriteLine("Got it!");
> }
You're using the wrong overload for ExecuteNonQuery - the one that
uses a "params object[]......" array (overload no. 4), not the one
using the SqlParameter[] array! (that would be overload no. 5).
In this case, the ExecuteNonQuery call does not know what kind of
parameters you've passed in, and thus cannot update them upon exiting.
Use this call instead:
SqlHelper.ExecuteNonQuery(_Connection, CommandType.StoredProcedure,
"GetMemberIDByEmail", aryParams);
*THEN* you should be able to access your output parameter.
Marc
================================================================
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
|