Hi i've been fighting with this one, no matter what i do i can't get the return value, this i swhat i have:
This is the storeProc which does update the table with the parameter in given in the c# code:
In the code behind page i have:
no matter what i try object SessionStr is always null, where as it should be the value from the select statement in the stored procedure. Any clues as to why i can't get a value returned?
Much appreciated.
This is the storeProc which does update the table with the parameter in given in the c# code:
Code:
CREATE PROCEDURE dbo.sp_StoreSec
(
@MemberID int,
@SecurStr nvarchar(300),
@Pass nvarchar(40),
@Question nvarchar(50),
@Answer nvarchar(40)
)
AS
SET NOCOUNT ON
INSERT INTO [_Credent] (MID,CredtStr) VALUES (@MemberID, @SecurStr)
UPDATE [_Info] SET pw=@Pass, sQ=@Question, sA=@Answer, isTemp=0
WHERE MID=@MemberID
SELECT TOP 1 Gender +'|'+ Convert(VarChar(7), PersonalID) +'|'+ Convert(VarChar(7), EMRID)
FROM [_MemberDemographics]
WHERE MemberID = @MemberID
RETURN
GO
In the code behind page i have:
Code:
...
SqlCommand cmd = new SqlCommand("sp_StoreSec", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@MemberID", SqlDbType.Int).Value = Convert.ToInt32(Session["MemberID"]);
cmd.Parameters.Add("@SecurStr", SqlDbType.NVarChar).Value = (ipaddress + "^" + hostName + "^" + OS + "^" + browser);
cmd.Parameters.Add("@Pass", SqlDbType.NVarChar).Value = Request.Form["p"].ToString();
cmd.Parameters.Add("@Question", SqlDbType.NVarChar).Value = Request.Form["q"].ToString();
cmd.Parameters.Add("@Answer", SqlDbType.NVarChar).Value = Request.Form["a"].ToString();
try
{
connection.Open();
object SessionStr = cmd.ExecuteScalar();
string dbstr = SessionStr.ToString();
connection.Close();
no matter what i try object SessionStr is always null, where as it should be the value from the select statement in the stored procedure. Any clues as to why i can't get a value returned?
Much appreciated.