Hi there,
I am entering data from a database into an array, the data is entered into the array correctly from the database I think.
But the problem arises when I try and print out the contents of my array. I get no error but the message I have used for testing prints this:
Your result-System.Collections.Generic.List`1[System.String]
It should print the contents of my array, heres the code:
I think the error is something to do with this line:
LineOfText = String.Concat("-", ar)
The function is called from a calendar control, when ever an event has more than one event/date attached - i would like the user to be able to see the contents of my array (each event on that date) and choose or dismiss the event details. Hope this makes sense, I guess the first problem is trying to get the array details to be printed correctly...
I am entering data from a database into an array, the data is entered into the array correctly from the database I think.
But the problem arises when I try and print out the contents of my array. I get no error but the message I have used for testing prints this:
Your result-System.Collections.Generic.List`1[System.String]
It should print the contents of my array, heres the code:
I think the error is something to do with this line:
LineOfText = String.Concat("-", ar)
VB.NET:
Private Sub multiple_dates()
'open calendar information
'todo move to module call()
Dim connetionString As String
Dim oledbCnn As OleDbConnection
Dim oledbCmd As OleDbCommand
Dim sql As String
Dim i As Integer
i = 0
sql = ""
'todo set password and user for database
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
'open and prepare connection
oledbCnn.Open()
oledbCmd = New OleDbCommand(sql, oledbCnn)
Dim oledbReader As OleDbDataReader = oledbCmd.ExecuteReader()
Do While oledbReader.Read
'move dates from database to listbox
'Dim d As Date = CType(oledbReader("date_from"), Date)
'ListBox1.Items.Add(d.ToShortDateString())
Dim cal_id As String
Dim date_from As String
Dim date_to As String
Dim notes As String
date_from = txtDateFrom.Text
If oledbReader("date_from") = date_from Then
Dim ar As New List(Of String)
cal_id = oledbReader("cal_date_id")
ar.Add(cal_id)
cal_id = oledbReader("date_from")
ar.Add(date_from)
date_to = oledbReader("date_to")
ar.Add(date_to)
notes = oledbReader("notes")
ar.Add(notes)
Dim LineOfText As String
LineOfText = String.Concat("-", ar)
MsgBox("Your result" & LineOfText)
End If
Loop
oledbReader.Close()
oledbCmd.Dispose()
oledbCnn.Close()
Catch ex As Exception
'get error message
MsgBox(ex.GetType.Name & " : " & ex.Message)
End Try
'get supplier or customer unique id
Call get_supp_cust()
'get the booking id
Call get_booking_id()
'get event id and
Call get_event_id()
'get address details if any
Call get_address_details()
End Sub
The function is called from a calendar control, when ever an event has more than one event/date attached - i would like the user to be able to see the contents of my array (each event on that date) and choose or dismiss the event details. Hope this makes sense, I guess the first problem is trying to get the array details to be printed correctly...