Dim strcon As SqlConnection = New SqlConnection("Data Source=JACKIE-PC;Initial Catalog=rsfab;Integrated Security=True")
Dim s As SqlCommand = New SqlCommand("select DISTINCT Test_Home.A_Home as 'บ้านเลขที่', Test_Home.Detail as'รายละเอียด', Test_Home.Limited as'พักสูงสุด', Test_Home.Rate as'ราคาต่อคืน', Test.D_In as'วันเข้า', Test.D_Out as'วันออก' from Test_Home INNER JOIN Test ON Test.A_Home = Test_Home.A_Home WHERE (NOT (D_In BETWEEN '" + dain.ToString("yyyy-MM-dd") + "' AND '" + daout.ToString("yyyy-MM-dd") + "')) AND (NOT (D_Out BETWEEN '" + dain.ToString("yyyy-MM-dd") + "' AND '" + daout.ToString("yyyy-MM-dd") + "')) ORDER BY Test_Home.A_Home ", strcon)
Dim resda As SqlDataAdapter = New SqlDataAdapter
resda.SelectCommand = s
strcon.Open()
Dim resds As DataSet = New DataSet
resda.Fill(resds)
strcon.Close()
GridView1.DataSource = resds
GridView1.DataBind()
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[SPWeb_GetAvailableRoomList]
@Plant VARCHAR(5),
@StartTime DATETIME,
@EndTime DATETIME,
@UserLV INT
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM meetingroom_v2 WHERE roomlocation=@Plant AND roomstatus='A' AND roomlv<=@UserLV AND roomID NOT IN (
SELECT room FROM roomreservation_v2 WHERE location=@Plant AND
(starttime BETWEEN CONVERT(VARCHAR(19),@StartTime,120) AND CONVERT(VARCHAR(19),@EndTime,120) OR
endtime BETWEEN CONVERT(VARCHAR(19),@StartTime,120) AND CONVERT(VARCHAR(19),@EndTime,120)))
END