Hello, I need to print to the listbox in the code here; however, instead of using numbers like 1-2-3-4-5, I need to print in the following format: 19:00 - 20:00, 20:00 - 21:00, 21:00 - 22:00. How can I achieve this?
To achieve this task, you can create a stored procedure named [dbo].[sp_BosKoltukListele] with the following code:
```sql
CREATE PROCEDURE [dbo].[sp_EmptySeatList]
@TripId int
AS
BEGIN
DECLARE @counter int = 19
DECLARE @Seats TABLE (SeatNumber int, Status varchar(10))
WHILE @counter <= 22
BEGIN
DECLARE @currentTime varchar(10)
SET @currentTime = FORMAT(@counter, '00') + ':00 - ' + FORMAT(@counter + 1, '00') + ':00'
IF (EXISTS(SELECT SeatNumber FROM Tbl_Tickets WHERE SeatNumber = @counter AND TripId = @TripId))
BEGIN
INSERT INTO @Seats (SeatNumber, Status) VALUES (@counter, '(Occupied)')
END
ELSE
BEGIN
INSERT INTO @Seats (SeatNumber, Status) VALUES (@counter, '')
END
SET @counter = @counter + 1
END
SELECT SeatNumber, CAST(SeatNumber as varchar(5)) + Status as SeatStatus
FROM @Seats
RETURN 0
END
```
This code will help you display the seat numbers in the format you specified within the listbox.
To achieve this task, you can create a stored procedure named [dbo].[sp_BosKoltukListele] with the following code:
```sql
CREATE PROCEDURE [dbo].[sp_EmptySeatList]
@TripId int
AS
BEGIN
DECLARE @counter int = 19
DECLARE @Seats TABLE (SeatNumber int, Status varchar(10))
WHILE @counter <= 22
BEGIN
DECLARE @currentTime varchar(10)
SET @currentTime = FORMAT(@counter, '00') + ':00 - ' + FORMAT(@counter + 1, '00') + ':00'
IF (EXISTS(SELECT SeatNumber FROM Tbl_Tickets WHERE SeatNumber = @counter AND TripId = @TripId))
BEGIN
INSERT INTO @Seats (SeatNumber, Status) VALUES (@counter, '(Occupied)')
END
ELSE
BEGIN
INSERT INTO @Seats (SeatNumber, Status) VALUES (@counter, '')
END
SET @counter = @counter + 1
END
SELECT SeatNumber, CAST(SeatNumber as varchar(5)) + Status as SeatStatus
FROM @Seats
RETURN 0
END
```
This code will help you display the seat numbers in the format you specified within the listbox.