我在数据库中有2个时间范围,名为funtime和funtime1(开始时间和结束时间)。
让我们假设这两个时间集。 上午8:00 - 上午9:00 上午9:00 - 上午10:00
逻辑上,没有冲突。但是在我的代码中..它认为是冲突.. 这是我的代码:
Dim str As String = "select * from tbl_funeral where date_burial = '" & t8.Text & "' and (('" & funtime.Text & "' between funtime and funtime1 ) or ( '" & funtime1.Text & "' between funtime and funtime1 ))"
Dim cmd As New MySqlCommand(str, con)
Dim da As New MySqlDataAdapter(cmd)
Dim dt As New DataTable
Dim ds As New DataSet
da.Fill(ds)
dt = ds.Tables(0)
Try
If (dt.DataSet.Tables(0).Rows.Count > 0) Then
MsgBox("There is a conflict on " & t8.Text & " at " & funtime.Text & "!", MsgBoxStyle.Exclamation, "Conflict")
Else
'AddSchedule()
add()
MsgBox("Scheduling was successful, would you like set more schedule?", MsgBoxStyle.Information, "Success")
rpt1.Show()
srt1.Text = " "
clearall()
con.Close()
End If
Catch ex As Exception
End Try
有没有办法让它正常工作?我在此期间所做的是将早上9:01而不是上午9:00放置,这样它就不会发生冲突。感谢〜!