i am new in this sector, i am making a traveling site, but some problem is facing. its a really big issue. i can't modified it.
please help me anyone can see my problem.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 4, 2014, 4:17 AM EDT
first the detail sproc is insert sproc, cna you please send the get sproc or in the get sproc you can set the where clause on status and order by with depature time.
rinku baruah32 reputationPosted Jun 4, 2014, 5:09 AM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 4, 2014, 5:17 AM EDT
please elobrate you question and send only the script where you are having a issue instead of full db objects.
Akhil MittalRank #133 · 16.9K reputationPosted Jun 4, 2014, 5:49 AM EDT
rinku baruah32 reputationPosted Jun 4, 2014, 8:57 PM EDT
} protected void add_bus()
{
cmd = new SqlCommand("Add_bus", con);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add("Bus_Name", System.Data.SqlDbType.VarChar).Value = Bus_Name.Text;
cmd.Parameters.Add("Dep_Time", System.Data.SqlDbType.DateTime).Value = Dep_Time.Text;
cmd.Parameters.Add("Arr_Time", System.Data.SqlDbType.DateTime).Value = Arr_Time.Text;
cmd.Parameters.Add("Seat_Details", System.Data.SqlDbType.Int).Value = check_seat_details(Bus_type.Text);
//cmd.Parameters.Add("Fare", System.Data.SqlDbType.Money).Value = Convert.ToDouble(Fare.Text);
cmd.Parameters.Add("Bus_type", System.Data.SqlDbType.VarChar).Value = Bus_type.Text;
cmd.Parameters.Add("Seat_Arrangement", System.Data.SqlDbType.VarChar).Value = "NIL";
cmd.Parameters.Add("start", System.Data.SqlDbType.VarChar).Value = Start_Place.Text;
// cmd.Parameters.Add("destination", System.Data.SqlDbType.VarChar).Value = Dest_Place.Text;
cmd.Parameters.Add("journey_date", System.Data.SqlDbType.DateTime).Value = Convert.ToDateTime(Date.Text);
cmd.Parameters.Add("available ", System.Data.SqlDbType.Int).Value = check_seat_details(Bus_type.Text);
cmd.Parameters.Add("booked", System.Data.SqlDbType.Int).Value = Convert.ToInt16("0");
cmd.Parameters.Add("bus_ref", System.Data.SqlDbType.Int).Value = get_bus_ref();
cmd.ExecuteNonQuery();
add_destinations();
}
and my sql table is -
/****** Object: StoredProcedure [dbo].[Add_bus] Script Date: 5/9/2014 5:01:10 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Add_bus]
(@Bus_Name nvarchar(max),@Dep_Time datetime,@Arr_Time datetime,@Seat_Details int,@Bus_type varchar(200),@Seat_Arrangement varchar(100),@start nvarchar(max),@journey_date datetime,@available int,@booked int,@bus_ref int)
as
begin
INSERT INTO [MyBus].[dbo].[Bus_Detail]
([Bus_Name]
,[Dep_Time]
,[Arr_Time]
,[Seat_Details]
,[Bus_Type]
,[Seat_Arrangement]
,[Start]
,[Journey_Date]
,[Available_Seats]
,[booked_seats],[bus_ref],[BusStatus])
VALUES
(@Bus_Name,@Dep_Time,@Arr_Time,@Seat_Details,@Bus_type,@Seat_Arrangement,@start,@journey_date,@available,@booked,@bus_ref,'Active')
end
/****** Object: Table [dbo].[Bus_Detail] Script Date: 5/9/2014 5:01:10 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Bus_Detail](
[Bus_Sno] [int] IDENTITY(1,1) NOT NULL,
[Bus_Name] [varchar](50) NULL,
[Dep_Time] [time](7) NULL,
[Arr_Time] [time](7) NULL,
[Seat_Details] [int] NULL,
[Fare] [money] NULL,
[Bus_Type] [varchar](100) NULL,
[Seat_Arrangement] [nvarchar](50) NULL,
[Start] [nvarchar](50) NULL,
[Destination] [nvarchar](50) NULL,
[Journey_Date] [date] NULL,
[Available_Seats] [int] NULL,
[booked_seats] [int] NULL,
[Bus_Ref] [int] NULL,
[BusStatus] [nvarchar](50) NULL,
CONSTRAINT [PK_Bus_Detail] PRIMARY KEY CLUSTERED
(
[Bus_Sno] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 4, 2014, 9:38 PM EDT
if so then create a sql job which will look the table and system datatime if time is passed then update the table with status as expiry.
rinku baruah32 reputationPosted Jun 4, 2014, 10:28 PM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 5, 2014, 12:11 AM EDT
http://www.c-sharpcorner.com/UploadFile/0fca19/step-by-step-procedure-to-create-a-job-task-in-sql-server-20/
http://www.c-sharpcorner.com/UploadFile/0f68f2/delete-and-create-files-with-a-sql-job-in-sql-server-2008/
rinku baruah32 reputationPosted Jun 6, 2014, 12:37 AM EDT