開始時間用と終了時間用の 2 つの列があります。両方ともタイプnvarchar
なので、比較できます。
ユーザーから時間を受け取り、時間が有効かどうかを確認するために自動的にポストバックするテキスト ボックスがあります。
Dim compared_time_1 As DateTime
Dim compared_time_2 As DateTime
Dim select_time As SqlCommand
select_time = New SqlCommand("select Start_Time , End_Time from Clinic_Schedule where Schedule_no = @sch_no", appt_DB_1)
select_time.Parameters.AddWithValue("@sch_no", Sch_no)
Dim time_rdr As SqlDataReader
time_rdr = select_time.ExecuteReader()
While time_rdr.Read
compared_time_1 = DateTime.Parse(start_time_1)
compared_time_2 = DateTime.Parse(end_time_1)
start_time_1 = time_rdr(0).ToString
end_time_1 = time_rdr(1).ToString
If appt_time_txt0.Text >= start_time_1 And appt_time_txt0.Text <= end_time_1 Then
date_valid_lbl0.Visible = True
date_valid_lbl0.Text = "*Valid Time"
Else
time_valid_lbl0.Visible = True
time_valid_lbl0.Text = "*Not Valid Time"
End If
End While
time_rdr.Close()
ロジック XD に問題があるかどうかはわかりません。これらの列に入力されたデータは次の形式です:00:00AM or 00:00PM.
ご協力をお願いします..ありがとう