Rocky Rocky

Rocky Rocky

  • NA
  • 317
  • 152.3k

what was problem in my code?

Jul 11 2013 2:07 AM
Hai Fireinds,

i ve the page like empdetails.apsx
in these i made 2 panels
I)empdeatils shows the details of

(username,age,department,employeecode) those thinks automatically shoe from database depends on the user Login.
travel purpose:textbox
total amount:textbox
if the person enter the text on purpose of travel request_id would be generated.
II)travel details show the information of,
departuredate:textbox,
from_place:textbox,
to_place:textbox,
mode :textbox,
add{button)
after given the add button entire details ll show on gridview table

here the problem is depends on the request_id panel-II
details ll be entered so i made the query like these............

MY procedure:
===============


alter procedure Insert_Journey
(
@departuredate datetime,
@from_location varchar(50),
@to_location varchar(50),
@metro nvarchar(50),
@trans_all nvarchar(50),
@mode_of_travel nvarchar(50),
@seat_type nvarchar(50),
@no_of_days int,
@other_details varchar(50),
@status_id int


)
as
BEGIN
DECLARE @MaxDate datetime,
@request int

SELECT @request = MAX(request_id) from travel_request a inner join users b on a.user_id=b.user_id
SELECT @MaxDate = MAX(DepartureDate) FROM onward_journey where request_id=@request


IF(@MaxDate > @departuredate)
begin

RAISERROR('Your error message for departuredate should be greater then maxdate',16,1)
RETURN
END

insert into onward_journey(departuredate,from_location,to_location,metro,trans_all,mode_of_travel,seat_type,no_of_days,other_details,status_id,request_id) values(@departuredate,@from_location,@to_location,@metro,@trans_all,@mode_of_travel,@seat_type,@no_of_days,@other_details,'2',@request)


end



when i choose the add panel-II details not inserted .......
what was error?

Answers (8)