• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2026 Replies
  • 331 Replies
    1928 Replies

Events in db

Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
User avatar
Dummy1912
VIP - Donator
Posts: 1998

Events in db

Sun May 05, 2019 6:32 pm

Hello,

can anyone helpme please
i like to load in my calendar all the events
that will repeat it every year

Code: Select all

    Dim startdate As DateTime = New Date(Currentdate.Year, Currentdate.Month, 1)
    Dim enddate As DateTime = startdate.AddMonths(1).AddDays(-1)

    Dim DataTable As DataTable = New DataTable()
    Dim attributes As String = "num,mdate,mcode,mcolors"
    Dim reader As SQLiteDataReader = mdlProcedures.executeQuery("Select " & attributes & " FROM mevents WHERE strftime('%Y-%m-%d', mdate) BETWEEN '" & startdate.ToString("yyyy-MM-dd") & "' AND '" & enddate.ToString("yyyy-MM-dd") & "';")
        'Dim reader As SQLiteDataReader = mdlProcedures.executeQuery("Select " & attributes & " FROM mevents WHERE date('2018-05-01','+1 year') BETWEEN '" & startdate.ToString("yyyy-MM-dd") & "' AND '" & enddate.ToString("yyyy-MM-dd") & "';")
        'Dim reader As SQLiteDataReader = mdlProcedures.executeQuery("Select " & attributes & " FROM mevents WHERE strftime('%m-%d', mdate) BETWEEN '" & startdate.ToString("yyyy-MM-dd") & "' AND '" & enddate.ToString("yyyy-MM-dd") & "';")

        DataTable.Load(reader)

    
       For Each row As DataRow In DataTable.Rows
          Dim appdt As DateTime = DateTime.Parse(row("mdate"))
Next
you see i tried a few things but not working at all

in my db we have mdate = -05-01
no year at all

so how can i get it work so he will read all the mdate to a full date 2019-05-01, 2020-05-01 ect....

Thank you

User avatar
Dummy1912
VIP - Donator
Posts: 1998

Re: Events in db

Sat Jun 01, 2019 6:07 pm

Hello,

has been solved
works like a charm to load my events from the db

just made the db looks like
day, month as integers
and that seems to be working very well.

Thanks

Post Reply

Return to “Coding Help & Support”