Hi. Googling this gives me 30 different answers, and I'm just getting more confused. I have an existing application that displays appointments on a calendar, but it uses a database, and I want to change it to xml. I've created a dataset and datable using xml but can't figure out how to alter the following code to query xml instead of the database.
Code:
Public Function QueryAsDataTable(ByVal sql As String) As DataTable
Dim da As New OleDbDataAdapter(sql, cn)
Dim ds As New DataSet
da.Fill(ds, "result")
Return ds.Tables("result")
End Function
Code:
Private Sub AddAppointmentToFlDay(ByVal startDayAtFlNumber As Integer)
Dim startDate As DateTime = New Date(currentDate.Year, currentDate.Month, 1)
Dim endDate As DateTime = startDate.AddMonths(1).AddDays(-1)
Dim sql As String = $"select * from appointment where AppDate between #{startDate.ToShortDateString()}# and #{endDate.ToShortDateString()}#"
Dim dt As DataTable = QueryAsDataTable(sql)
For Each row As DataRow In dt.Rows
Dim appDay As DateTime = DateTime.Parse(row("AppDate"))
Dim link As New LinkLabel
link.Tag = row("ID")
link.Name = $"link{row("ID")}"
link.Text = row("ContactName")
AddHandler link.Click, AddressOf ShowAppointmentDetail
listFlDay((appDay.Day - 1) + (startDayAtFlNumber - 1)).Controls.Add(link)
Next
End Sub
that cn part was just the oledb connection. The calendar uses flowlayoutpanel to display the days in separate panels.
Any help would be appreciated - Thanks