[Solved] Error: invalid object name Room in ASP.Net

Last Reply 12 days ago By jochk12345

Posted 14 days ago

Here i created a sample page of room booking.

I tried to fetch room availability from database based on selected date.

for eg: if i select todays date i want to bind free rooms available on today. But getting error on my page "invalid object name Room"

(looks like the error is in stored procedure).

alter procedure sp_roombooking (@datepicked varchar(55))
as
begin
    select r.* from Room r,Reservation r1 
    where @datepicked not in( select @datepicked from Registration1 r1 where  r1.fromdate<@datepicked and r1.todate>@datepicked)
end

 

Posted 14 days ago

Hi jochk12345,

Please verify your table Name. It might be worng or it might be in different schema other than dbo.


Posted 12 days ago

below code is wroking.

ALTER procedure [dbo].[sp_roombooking1]
( 
   @datepicked varchar(55)	 
)
as
begin
    select r.RoomId,r.RoomName,r.RoomStatus
    from Room r,Reservation1 r1
    where r.RoomName not in
            (
                select r1.Roomname from Reservation1 r1 
                where r1.fromdate <=@datepicked and r1.todate >=@datepicked and r1.RoomStatus=1
	    )
			
end