can any one help me in one process..i want to display idcount in message box.
my stored procedure
ALTER PROCEDURE [dbo].[Transaction]
(

@Patient nvarchar(50),
@E_TO nvarchar(50),
@R_type int,
@User_id uniqueidentifier,
@ReportType nvarchar(50),
@Patient_no int,
@Patient_ID_NO numeric(18,0),
@idcount int output

)
AS
BEGIN

declare @tempid int
set @tempid = 0;
declare @idcnt int
select @idcnt =isnull( max(idcount),0) from Transactions where year(R_date)=year(getdate())
if (@idcnt =0)
set @tempid=1
else
set @tempid = @idcnt +1


INSERT INTO dbo.Transactions (Patient,E_TO,R_date,R_from,User_id,report_type,Patient_no,Patient_ID_NO,idcount)values (@Patient,@E_TO,getdate(),@R_type,@User_id,@ReportType,@Patient_no,@Patient_ID_NO,@tempid)
return @idcount
END

these line of code i am using for fetching the the column , but its displaying -1 only , i am using linq to sql.


int? idcount = -1;

try
{

var q = db.Transaction(Patient_name, Export_TO,replay_To_type,null,repType,PatNoVal,PatID,ref idcount);

}

ClientScript.RegisterStartupScript(this.GetType(), "Message", "alert('Your ID is :" + idcount + "');", true);