Dim intNumRows As Integer
comm = "SELECT COUNT(*) FROM RESV WHERE ROOM_ID = '" & Me.DropDownList1.SelectedValue & "' AND DATE_FROM BETWEEN Convert(DateTime, '" & Me.CalendarPopup1.SelectedDate & "', 103) AND Convert(DateTime, '" & Me.CalendarPopup2.SelectedDate & "', 103) AND DATE_TO BETWEEN Convert(DateTime, '" & Me.CalendarPopup1.SelectedDate & "', 103) AND Convert(DateTime, '" & Me.CalendarPopup2.SelectedDate & "', 103)"
Dim ccommand As New SqlCommand(comm, conn)
intNumRows = ccommand.ExecuteScalar()
If intNumRows > 0 Then
Label1.Text = "ห้องพักในวันเวลาดังกล่าวถูกจองไว้แล้ว กรุณาเลือกใหม่อีกครั้ง"
Else