none
Display message from sql LINQ column using c# RRS feed

  • Question

  • how cani display idcount in message box from sql server in c# using LINQ ,idcount is auto increment,the  stored procedure is  

    ALTER PROCEDURE [dbo].[Transaction] 


    @Patient nvarchar(50),
    @E_TO nvarchar(50),
    @R_type int,
    @User_id uniqueidentifier,
    @ReportType nvarchar(50),
    @Patient_no int


    AS 
    BEGIN 

    declare @tempid numeric(18,0)
    set @tempid = 0; 
    declare @idcnt numeric(18,0)
    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)values (@Patient,@E_TO,getdate(),@R_type,@User_id,@ReportType,@Patient_no)

    END

    i want to display "idcount" in my message box,. using c#.



    New born in developing

    • Moved by Naomi N Monday, June 11, 2012 1:27 AM May be better answer here (From:Transact-SQL)
    Sunday, June 10, 2012 7:28 AM

Answers

  • one issue has ben solved  the column which is giving trouble while inserting is noe inserting the data

    i changed the column datatype to numeric(18,0)

    and convert like this  decimal PatID = decimal.Parse(PatID_NO.Text); it work fine ..


    New born in developing

    Tuesday, June 26, 2012 8:00 AM

All replies