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

How, Relations

User avatar
Dummy1912
VIP - Donator
Posts: 1998

How, Relations

Sat May 04, 2019 8:38 am

Hello,

i needs some help
i can't figure it out how to make it work
no errors but code stops :(

Code: Select all

        Dim DataTable As DataTable = New DataTable()
        Dim attributes As String = "mtable.num,mtable.mdate,mshifts.mname,mshifts.mcolor,mtable.mtitle Relation"
        Dim fromClause As String = "left JOIN mshifts ON mshifts.num = mtable.mcategorie"
        Dim reader As SQLiteDataReader = mdlProcedures.executeQuery("SELECT " & attributes & " FROM mtable " & fromClause & " WHERE strftime('%Y-%m-%d', mtable.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") 'i like to get the mdate from the table mtable
            Next
Thanks

User avatar
Dummy1912
VIP - Donator
Posts: 1998

Re: How, Relations

Sat May 04, 2019 10:27 am

Pffff that was fun

solved it :nersmile

Code: Select all

        Dim DataTable As DataTable = New DataTable()
        Dim attributes As String = "mtable.num,mtable.mdate,mshifts.mname,mshifts.mcolor,mtable.mtitle"
        Dim fromClause As String = "CROSS JOIN mshifts ON mshifts.num = mtable.mcategorie"
        Dim reader As SQLiteDataReader = mdlProcedures.executeQuery("SELECT " & attributes & " FROM mtable " & fromClause & " WHERE strftime('%Y-%m-%d', mtable.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

User avatar
CodenStuff
Site Admin
Posts: 4386

Re: How, Relations

Sat May 04, 2019 6:47 pm

lol Ah the joy and happiness of solving a code problem on your own :)
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.


Post Reply

Return to “Help & Support”