Question Resolving Present Date to tally with Birthday

stanbuggy

Member
Joined
Oct 25, 2010
Messages
18
Programming Experience
Beginner
Hi friends,
i am working on a small VB.net project and i was told to include a function where if the registered date of birth of a member equals todays date (Day and Month of course), an alert should be triggered , maybe an alarm or a Msg box poping up whenever the application is loaded saying that today is Member X birthday.

I have no idea whatsoever on how to handle this...

Pls would appreciate urgent help...

Wouldn't mind actual code.

Thanks a million in advance
 
First of all, how is the members data stored? For checking a date you can use something like this:

VB.NET:
If Date.Parse("5/19/2011").Date = Now.Date Then
    MsgBox("Match")
End If

But to return a specific members ID/name we will need to know how the info is stored.
 
Hi Josh, Thanks for your reply...

But how do u mean how Members data is stored? I stored them the normal way..my backend database is MS Access and here is my insert code

str = "insert into members(fname,occupation,age,dob,tel,oaddy,haddy,email,pix,date_reg) values ('" & txtfname.Text & "','" & txtocc.Text & "','" & txtage.Text & "','" & dob.Text & "','" & txttel.Text & "','" & txtaddy.Text & "','" & txthaddy.Text & "','" & txtemail.Text & "','" & OpenFileDialog1.FileName & "','" & dtpreg.Text & "')"
'string stores the command and CInt is used to convert number to string
cmd = New OleDbCommand(str, cn)
cmd.ExecuteNonQuery()

MsgBox("Member Record Saved", MsgBoxStyle.Information, "RCCG MMS")


dob is the date of birth picked from a date time picker.

Thanks
 
OK, I am not very familiar with databases, but here is what you could use to check a date in string format:

VB.NET:
Private Function checkDate(strDate As String) As Boolean
    If Date.Parse(strDate).Date = Now.Date Then
        Return True
    Else
        Return False
    End If
End Function
 
Hi friends,
i am working on a small VB.net project and i was told to include a function where if the registered date of birth of a member equals todays date (Day and Month of course), an alert should be triggered , maybe an alarm or a Msg box poping up whenever the application is loaded saying that today is Member X birthday.
After reading this statement, I'm not sure who is using the application. Are you meaning that a registered user opens the application and a message box says happy birthday to the user if it is their birthday; or an administrator opens the application and a list of users with birthdays that day are displayed?

stanbuggy said:
str = "insert into members(fname,occupation,age,dob,tel,oaddy,haddy,email,pix,date_reg) values ('" & txtfname.Text & "','" & txtocc.Text & "','" & txtage.Text & "','" & dob.Text & "','" & txttel.Text & "','" & txtaddy.Text & "','" & txthaddy.Text & "','" & txtemail.Text & "','" & OpenFileDialog1.FileName & "','" & dtpreg.Text & "')"
'string stores the command and CInt is used to convert number to string
cmd = New OleDbCommand(str, cn)
cmd.ExecuteNonQuery()
Please research parameters; not using them leaves you open to SQL injection and many other security risks.
 
Hi Paszt,
You asked a nice question? Well the application is used by the admin only. Its when the admin opens the application then he see a pop up or whatever maybe a list of members having their birthday's that day..so he can either send them emails or text messages.

Hope you get the picture now.

Thanks in advance man
 
Back
Top