Procedure or function 'spSaveCheckIn' expects parameter '@CheckinId', which was not supplied.

  • public int Checkinroom (

    char chmod, int CheckinId, string bookmod, DateTime bookdate, string bookingyearmonth,string bookno, DateTime arrivaldate, string arrtime,

    DateTime depaturedate, string deptime, int nights, string guestname, string bookby, string visitpurpose, string gender, int male,

    int female, int child, string address, string city, int pin, string state, string nationality,

    Boolean IsForigner, int forignerId, string idproof, string idproofdetail, Boolean IsFromComp, int compId, int phone, DateTime bdate, DateTime weddate,

    string email, string roomtype, int roomno, double roomrate, Boolean IsPackage, string pkgtype, double pkgrate, double pkgdisc,

    string tariffhr, double tariffrate, double extra, double disc, string bookstatus, string paymode,

    double totamt, double advance, double pendingamt, string CDno, string bankname, string branchname,

    DateTime chequedate, string remarks, int userid )

    {

    if (chmod == 'I')

    {

    CheckinId = Convert.ToInt16(dbHelper.getMaxID("select max(CheckinId)as MaxValue from CheckIn ", System.Data.CommandType.Text));

    }

    dbHelper.AddParameter("@CheckinId", CheckinId);

    dbHelper.AddParameter("@bookmod", bookmod);

    dbHelper.AddParameter("@bookdate", bookdate);

    dbHelper.AddParameter("@bookingYearMonth", bookingyearmonth);

    dbHelper.AddParameter("@bookno", bookno);

    dbHelper.AddParameter("@arrivaldate", arrivaldate);

    dbHelper.AddParameter("@arrivalTime", arrtime);

    dbHelper.AddParameter("@depaturedate", depaturedate);

    dbHelper.AddParameter("@departuretime", deptime);

    dbHelper.AddParameter("@nights", nights);

    dbHelper.AddParameter("@guestname", guestname);

    dbHelper.AddParameter("@bookby", bookby);

    dbHelper.AddParameter("@visitpurpose", visitpurpose);

    dbHelper.AddParameter("@gender", gender);

    dbHelper.AddParameter("@male", male);

    dbHelper.AddParameter("@female", female);

    dbHelper.AddParameter("@child", child);

    dbHelper.AddParameter("@address", address);

    dbHelper.AddParameter("@city", city);

    dbHelper.AddParameter("@pin", pin);

    dbHelper.AddParameter("@state", state);

    dbHelper.AddParameter("@nationality", nationality);

    dbHelper.AddParameter("@IsForigner", IsForigner);

    if (IsForigner == true)

    {

    forignerId = Convert.ToInt16(dbHelper.getMaxID("select max(id)as MaxValue from Foreigner", System.Data.CommandType.Text));

    }

    else

    {

    forignerId = 0;

    }

    dbHelper.AddParameter("@ForignerID", forignerId);

    dbHelper.AddParameter("@idproof", idproof);

    dbHelper.AddParameter("@idproofdetail", idproofdetail);

    dbHelper.AddParameter("@IsFromCompany", IsFromComp);

    dbHelper.AddParameter("@companyId", compId);

    dbHelper.AddParameter("@MobileNo", phone);

    dbHelper.AddParameter("@BirthDate", bdate);

    dbHelper.AddParameter("@wedingdate", weddate);

    dbHelper.AddParameter("@emailid", email);

    dbHelper.AddParameter("@roomtype", roomtype);

    dbHelper.AddParameter("@roomno", roomno);

    dbHelper.AddParameter("@roomrate", roomrate);

    dbHelper.AddParameter("@IsPackage", IsPackage);

    dbHelper.AddParameter("@pkgtype", pkgtype);

    dbHelper.AddParameter("@pkgrate", pkgrate);

    dbHelper.AddParameter("@packagediscount", pkgdisc);

    dbHelper.AddParameter("@tariff", tariffhr);

    dbHelper.AddParameter("@tariffrate", tariffrate);

    dbHelper.AddParameter("@extra", extra);

    dbHelper.AddParameter("@discount", disc);

    dbHelper.AddParameter("@bookingstatus", bookstatus);

    dbHelper.AddParameter("@paymentmode", paymode);

    dbHelper.AddParameter("@totalamt", totamt);

    dbHelper.AddParameter("@advance", advance);

    dbHelper.AddParameter("@pendingamt", pendingamt);

    dbHelper.AddParameter("@CDno", CDno);

    dbHelper.AddParameter("@bankname", bankname);

    dbHelper.AddParameter("@branchname", branchname);

    dbHelper.AddParameter("@chequedate", chequedate);

    dbHelper.AddParameter("@remarks", remarks);

    dbHelper.AddParameter("@recordstatus", chmod);

    dbHelper.AddParameter("@disabled", 'n');

    return dbHelper.InsertAndUpdate("spSaveCheckIn", System.Data.CommandType.StoredProcedure, userid);

    }

    //END OF CODE

    //NOW MY STORED PROCEDURE IS LIKE THIS...

    USE [HMSystem]

    GO

    /****** Object: StoredProcedure [dbo].[spSaveCheckIn] Script Date: 08/10/2011 19:39:11 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    set nocount on;

    go

    ALTER PROCEDURE [dbo].[spSaveCheckIn]

    (@CheckinId int,

    @bookmod varchar(100),

    @bookdate datetime,

    @bookingyearmonth varchar(7),

    @bookno varchar(10),

    @arrivaldate datetime,

    @arrivalTime varchar(50),

    @depaturedate datetime ,

    @departuretime varchar(50) ,

    @nights int ,

    @guestname varchar(100),

    @bookby varchar(100),

    @visitpurpose varchar(50),

    @gender varchar(15),

    @male int,

    @female int ,

    @child int,

    @address varchar(200),

    @city varchar(50),

    @pin int,

    @state varchar(10) ,

    @nationality varchar(10),

    @IsForigner bit,

    @ForignerID int,

    @idproof varchar(50),

    @idproofdetail varchar(100),

    @IsFromCompany bit ,

    @companyId int,

    @MobileNo int,

    @BirthDate datetime,

    @wedingdate datetime,

    @emailid varchar(100),

    @roomtype varchar(50),

    @roomno int,

    @roomrate numeric(18,2),

    @IsPackage bit,

    @pkgtype varchar(50),

    @pkgrate numeric(18,2),

    @packagediscount numeric(18,0),

    @tariff varchar(50) ,

    @tariffrate numeric(18,2),

    @extra numeric(18,2),

    @discount numeric(18,0),

    @bookingstatus varchar(20),

    @paymentmode varchar(50),

    @totalamt numeric(18,2),

    @advance numeric(18,2),

    @pendingamt numeric(18,2),

    @CDno varchar(100),

    @bankname varchar(100),

    @branchname varchar(100),

    @chequedate datetime ,

    @remarks varchar(500),

    @recordstatus char(1),

    @disabled char(1),

    @modbyuserid int,

    @statusdate datetime out

    )

    as

    if(@recordstatus = 'I')

    insert into CheckIn

    values(

    @CheckinId ,

    @bookmod ,

    @bookdate ,

    @bookingyearmonth,

    @bookno ,

    @arrivaldate,

    @arrivalTime ,

    @depaturedate,

    @departuretime ,

    @nights ,

    @guestname ,

    @bookby ,

    @visitpurpose ,

    @gender ,

    @male ,

    @female,

    @child ,

    @address,

    @city ,

    @pin ,

    @state ,

    @nationality,

    @IsForigner,

    @ForignerID ,

    @idproof ,

    @idproofdetail ,

    @IsFromCompany ,

    @companyId ,

    @MobileNo ,

    @BirthDate ,

    @wedingdate ,

    @emailid ,

    @roomtype ,

    @roomno ,

    @roomrate,

    @IsPackage,

    @pkgtype ,

    @pkgrate,

    @packagediscount,

    @tariff,

    @tariffrate,

    @extra,

    @discount,

    @bookingstatus ,

    @paymentmode ,

    @totalamt ,

    @advance ,

    @pendingamt ,

    @CDno ,

    @bankname ,

    @branchname,

    @chequedate ,

    @remarks ,

    @recordstatus ,

    @disabled,

    @modbyuserid ,

    @statusdate )

    if(@recordstatus = 'U')

    update CheckIn

    set

    BookingMode=@bookmod ,

    BookingDate=@bookdate ,

    BookingYearMonth=@bookingyearmonth,

    BookingNo=@bookno ,

    ArrivalDate=@arrivaldate,

    ArrivalTime=@arrivalTime ,

    DepartureDate =@depaturedate,

    DepartureTime=@departuretime ,

    Nightshold=@nights ,

    GuestName=@guestname ,

    BookingBy=@bookby ,

    VisitPupose=@visitpurpose ,

    Gender=@gender ,

    Male=@male ,

    Female=@female,

    Childern=@child ,

    Address=@address,

    City=@city ,

    pin=@pin ,

    State=@state ,

    Nationality=@nationality,

    IsForigner=@IsForigner,

    ForignerID=@ForignerID ,

    IDProof=@idproof ,

    IDProofdetail=@idproofdetail ,

    IsFromCompany=@IsFromCompany ,

    companyId=@companyId ,

    MobileNo=@MobileNo ,

    BirthDate=@BirthDate ,

    weddingdate=@wedingdate ,

    emailid=@emailid ,

    roomtype=@roomtype ,

    RoomNo=@roomno ,

    RoomRate=@roomrate,

    IsPackage=@IsPackage,

    packagetype=@pkgtype ,

    packagerate=@pkgrate,

    packagediscount=@packagediscount,

    tariff=@tariff,

    tariffrate=@tariffrate,

    extra=@extra,

    discount=@discount,

    BookingStatus=@bookingstatus ,

    PaymentMode=@paymentmode ,

    TotalAmt=@totalamt ,

    CreditOrAdvanced=@advance ,

    PendingAmt=@pendingamt ,

    ChequeOrDraftNo=@CDno ,

    Bankname=@bankname ,

    BranchName=@branchname,

    ChequeDate=@chequedate ,

    Remarks=@remarks ,

    recordstatus=@recordstatus,

    disabled =@disabled,

    modbyuserid=@modbyuserid,

    statusdate=@statusdate

    where CheckinId=@CheckinId

    if(@recordstatus = 'D')

    update CheckIn set recordstatus=@recordstatus,modbyuserid=@modbyuserid,statusdate=@statusdate

    where CheckinId=@CheckinId

    //pLEASE HELP ME FRIENDS...M STUCKED AT ERROR

    Procedure or function 'spSaveCheckIn' expects parameter '@CheckinId', which was not supplied.

  • That error message is pretty self explanatory. You did not provide the required parameter to sql. I see a lot of c# code referencing a user defined data access piece. That is probably where the problem is. I suspect if you run a server trace you will see that the proc is being called with no parameters.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • hI there is nothing but probably it may have sql server error which you have to check from your procedure

    here i have paste the link where i have describe how to check parameterize error on sql server .

    http://sqldebate.blogspot.in/2012/01/procedure-or-function-expects-parameter.html

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply