Results 1 to 1 of 1

Thread: Problem in stored procedure through C#.Net

  1. #1
    Join Date
    Jan 2007
    Posts
    1

    Question Problem in stored procedure through C#.Net

    Hi every1,
    i m facing a problem with my stored procedure,named "procPayment".
    I am doing update or insert through this stored procedure depending on whether that empid exist in table Paymentmaster.if data exist in table ,"procPayment" will upadte the other details if not it will insert the details...
    i wud like to get whether my syntax is fine or not'my stored procedure is like this :

    DELIMITER $$;

    DROP PROCEDURE IF EXISTS `jaldb`.`procPayment`$$

    CREATE DEFINER=`jaldb`@`badda` PROCEDURE `procPayment`
    (
    in yr integer,in mnth integer,in varempid text,
    p_conveyenceAllownce text,p_deputation text,p_Exgratia text,p_GPF text,p_HouseLoan text,
    p_HRA text,p_HillDevAllowance text,p_MedicalAdvance text,p_MedicalReimb text,p_Other1 text,
    p_Other2 text,p_OverTime text,p_Personal text,p_TABill text,p_TravelAdvance text,p_MedicalAllowance text,p_Basic text,p_Add text,p_AdditionalDA text,p_DA text,p_employeeid text,p_monthid text,p_special text,p_TotalPayment text,p_ToBank text
    )

    BEGIN
    declare empidnew text;
    declare paydate varchar(10);
    declare tempempid text;
    if mnth <10 then
    set paydate = concat('01','/0',mnth,'/',yr);
    else
    set paydate = concat('01','/',mnth,'/',yr);
    end if;

    set tempempid = concat('0', varempid);
    set empidnew=(Select empid from paymentmaster where payrolldate=paydate and empid=varempid);

    if (empidnew != null) then

    update paymentmaster
    set
    Basic=p_Basic,
    add50per=p_Add,
    special=p_special,
    conveyanceallowance=p_conveyenceAllownce,
    deputation=p_deputation,
    personal=p_Personal,
    DA=p_DA,
    additionalDA=p_AdditionalDA,
    HRA=p_HRA,
    hilldevAllowance=p_HillDevAllowance,
    overtime=p_OverTime,
    MedicalAdvance=p_MedicalAdvance,
    GPFAdvance=p_GPF,
    medicalallowance=p_MedicalAllowance,
    exgratia=p_Exgratia,
    houseloan=p_HouseLoan,
    medicalreimb=p_MedicalReimb,
    traveladvance=p_TravelAdvance,
    TABill=p_TABill,
    other1=p_Other1,
    other2=p_Other2,
    totalpayment=p_TotalPayment,
    tobank=p_ToBank
    where empid=varempid;

    ELSE

    insert into paymentmaster
    (
    empid,payrollDate, Basic, Add50per, Special,ConveyanceAllowance,
    Deputation,Personal,DA,AdditionalDA,HRA,HillDevAll owance,OverTime,
    MedicalAdvance,GPFAdvance,MedicalAllowance,
    Exgratia,HouseLoan,MedicalReimb,TravelAdvance,TABi ll,Other1,Other2,
    TotalPayment,ToBank,ltaMasterId
    )
    values
    (
    empidnew, paydate,p_Basic,p_Add,p_special,p_conveyenceAllown ce,
    p_deputation,p_Personal,p_DA,p_AdditionalDA,p_HRA, p_HillDevAllowance,p_OverTim e,
    p_MedicalAdvance,p_GPF,p_MedicalAllowance,
    p_Exgratia,p_HouseLoan,p_MedicalReimb,p_TravelAdva nce,p_TABill,p_Other1,p_Othe r2,
    p_TotalPayment,ToBank,0
    );

    end if;

    END$$

    DELIMITER ;$$
    Last edited by manish.arya21; 01-25-2007 at 12:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •