TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ZULFAHMI AIDI
NA
8
0
Cant load data using time
Mar 19 2010 12:00 PM
Hi there,
I going to build a program that notify me daily according to time which i have save it in the database table. The idea is when the current time in the system is equal to the time stored in the database, the system will prompt the notification such as msgbox.
My table are
Notify
Field
Type
Example Data
ID
Text
1
Name
Text
Zul
Time1
Text
4:00 AM
Time2
Text
12:00 PM
Time3
Text
8:00 PM
Code to run current time and to validate the current data exist in the table
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
timeToday.Text = System.DateTime.Now.ToShortTimeString
Dim cmd1 As New OleDbCommand("Select * from Notify where '" & timeToday.Text & "' = Time1 OR Time2 OR Time3", OleDbConnection)
Try
OleDbConnection.Open()
OleDbDataReader = cmd1.ExecuteReader()
MsgBox(OleDbDataReader("Name"))
Catch ex As OleDbException
' Create and error column header
Dim ErrorHeader As New ColumnHeader()
ErrorHeader.Text = "oledb Error"
'ListPR.Columns.Add(ErrorHeader)
Finally
OleDbConnection.Close()
End Try
End Sub
Result:
No data exists for the row/column on the
MsgBox(OleDbDataReader("Name"))
I also try to make an simple statement in the timer code by such as below but it cant work. It like that the
10:30 PM
is not in time format
If
timeToday
.text = "
10:30 PM
" true then
msgbox("Hi there")
end if
Can anyone help me with this problem?
Reply
Answers (
4
)
Select current date between Start date and End date
sysntax Error in INSERT INTO statement