Hi
See, I want to store a value returned from Stored Proc in a session
using C#...Yes I will post code------
ALTER PROCEDURE Applicant1
@FirstName char(20),
@MiddleName char(20),
@LastName char(20),
@DoB Datetime,
@Gender Char(10),
@Email varchar(20),
@Mobile numeric(12,0),
@ResumePath varchar(MAX),
@Address varchar(MAX),
@City char(30),
@State int,
@Country int,
@Pin numeric(10,0),
@phone numeric(15,0),
@Addressp varchar(MAX),
@Cityp char(30),
@Statep int,
@Countryp int,
@Pinp numeric(10,0),
@phonep numeric(15,0),
@Hobbies varchar(250),
@Interests varchar(250),
@Achievements varchar(250),
@IsPermanentAddress bit,
@ApplicantID int output
AS
SET NOCOUNT ON
IF @IsPermanentAddress = 0
begin
INSERT INTO
Applicant(FirstName,MiddleName,LastName,Gender,Email,Mobile,ResumePath,DoB)
Values(@FirstName,@MiddleName,@LastName,@Gender,@Email,@Mobile,@ResumePath,@DoB)
select @ApplicantID = @@Identity
insert into
ContactDetails(Address,City,StateID,CountryID,Pin,Phone,IsPermanentAddress,ApplicantID)
values(@Address,@City,@State,@Country,@Pin,@Phone,@IsPermanentAddress,@ApplicantID)
insert into PersonalDetails(Hobbies,Interests,Achievements,ApplicantID)
values(@Hobbies,@Interests,@Achievements,@ApplicantID)
end
ELSE
INSERT INTO
Applicant(FirstName,MiddleName,LastName,DoB,Gender,Email,Mobile,ResumePath)
Values(@FirstName,@MiddleName,@LastName,@DoB,@Gender,@Email,@Mobile,@ResumePath)
select @ApplicantID = @@Identity
insert into
ContactDetails(Address,City,StateID,CountryID,Pin,Phone,IsPermanentAddress,ApplicantID)
values(@Address,@City,@State,@Country,@Pin,@Phone,@IsPermanentAddress,@ApplicantID)
insert into
ContactDetails(Address,City,StateID,CountryID,Pin,Phone,IsPermanentAddress,ApplicantID)
values(@Addressp,@Cityp,@Statep,@Countryp,@Pinp,@Phonep,@IsPermanentAddress,@ApplicantID)
insert into PersonalDetails(Hobbies,Interests,Achievements,ApplicantID)
values(@Hobbies,@Interests,@Achievements,@ApplicantID)
RETURN @ApplicantID
--------------------------------------------------------------------------------------------------------------------------------
This SP is returning ApplicantID.I have to store this ID in a session,
Then I will pass that value in other SP.So just I want to know that How
I can store this value in session..ApplicantID is not inserted from
front end, It just exists in Database....
Hope u understood what I exactly want...
Regards
Raghav..
donet said:
what exactly are you trying to achieve?? can you post some sample
code...???
raghav wrote:
Hi all
I am having a SP which is returning a value......Now I have to store
that value
in session...I saw some examples in msdn lib ---->
string Name=string.Empty;
Session["Raghav"]=Name.ToString();
But in my case return value is ID ...and it has not been declared in C#
code as Name is declared in Above exapmle...bec i am not inserting that
ID from front end....
So what will be the C# code to store value returned from SP in a
session?I posted this query in other group also but no good
response....Looking for further responses...
--Raghav