Hi there,
I have a calendar control that i want the dates to be bolded from values that are taken from a database. The values are pulled from the database into a listview, I was trying to get the values from the listview to be added to an array then this array of dates passed to the calendar control so that the dates from shown in bold? At the moment the code just says is cannot open the database...not sure but i think the logic may be wrong??...anyone any ideas?...
I have a calendar control that i want the dates to be bolded from values that are taken from a database. The values are pulled from the database into a listview, I was trying to get the values from the listview to be added to an array then this array of dates passed to the calendar control so that the dates from shown in bold? At the moment the code just says is cannot open the database...not sure but i think the logic may be wrong??...anyone any ideas?...
VB.NET:
Dim connetionString As String
Dim oledbCnn As OleDbConnection
Dim oledbCmd As OleDbCommand
Dim sql As String
connetionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=H:\My Pictures\hotel_db.mdb;User Id=admin;Password=;"
sql = "Select * from tbl_calendar"
oledbCnn = New OleDbConnection(connetionString)
Try
oledbCnn.Open()
oledbCmd = New OleDbCommand(sql, oledbCnn)
Dim oledbReader As OleDbDataReader = oledbCmd.ExecuteReader()
Do While oledbReader.Read
Dim arrayList1 As ArrayList = New ArrayList(1)
ListBox1.Items.Add(oledbReader("date_from")).ToString("yyyy-MM-dd")
arrayList1.Add(ListBox1.Items)
Dim i As Integer
MonthCalendar1.AddBoldedDate(New Date(arrayList1.Item(i + 1)))
MonthCalendar1.UpdateBoldedDates()
i = i + 1
'ListBox1.Items.Add(oledbReader("columnname").ToString())
'ListBox1.Items.Add(oledbReader(index).ToString())
'ListBox1.Items.Add(oledbReader(index).ToString())
'ListBox1.Items.Add(oledbReader("columnname").ToString())
'ListBox1.Items.Add(oledbReader(0))
'ListBox1.Items.Add(oledbReader(1))
'ListBox1.Items.Add(oledbReader(2))
'TextBox3.Text = oledbReader(0)
'TextBox4.Text = oledbReader(1)
'TextBox5.Text = oledbReader(2)
Loop
oledbReader.Close()
oledbCmd.Dispose()
oledbCnn.Close()
Catch ex As Exception
MsgBox("Can not open connection ! ")
End Try