I want to add a column to my dataset that contains the returned bDay from the NextBday function. Is that possible. This may look familiar to some of you because I attempted to do something similar with ZipCodes a while back. However I never found a proper solution for that problem and used a quick hack to get by for the time.
VB Code:
Function NextBday(ByVal aDOB As Date) As Date Dim bDay As New Date(Date.Today.Year, aDOB.Month, aDOB.Day) If bDay <= Date.Today Then bDay = bDay.AddYears(1) End If Return bDay End Function Function GetBirthdays() As DataSet Dim strCon As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "DATA Source=c:\data\info.mdb") Dim dtDateStart As Date = Date.Today Dim dtDateEnd As Date = dtDateStart.AddDays(30) Dim conn As OleDbConnection = New OleDbConnection(strCon) Dim strSelect As String = _ "Select Store, Name, bDate From UeosBday Where " & _ "bDate >=" & dtDateStart & " And " & _ "bdate <=" & dtDateEnd & " Order by bDate" Dim Cmd As New OleDbDataAdapter(strSelect, conn) Dim ds As New DataSet Cmd.Fill(ds, "bDays") With ds ' I am looking for a way to run every bDate in ' the ds through the NextBday function. The purpose ' of this is to find the next birthday of each employee ' in a 30 day period. ' For instance if a persons birthday is 9/12/1969 the ' function brings it current by making it 9/12/200x ' and then compares it to todays date. If todays date ' is later then the returned date it adds a year. If not ' it just returns the converted date (9/12/2006). End With ' Is there a better way to do this then the way I am attempting it? Return ds End Function




Reply With Quote