BobInCalgary
New member
- Joined
- Dec 15, 2012
- Messages
- 4
- Programming Experience
- 3-5
I am reading an access database and populating various objects using oledb datareader.
The couple of lines of code below works as intended:
dim somestring as string
somestring = reader("eventname").ToString
(the data element 'eventname' is defined as a text field in the database)
however
dim somestring as string
somestring = reader.getstring("eventname")
throws the error "conversion from string 'eventname' to integer is not valid"
The msdn documentation states: OleDbDataReader.GetString Method
Gets the value of the specified column as a string
syntax:
Public Overrides Function GetString (ordinal As Integer) As String
My app works fine but I would have thought that .getstring would return a string that could be assigned to a string variable?
Perhaps I'm missing something obvious, but would appreciate any clarification.
Thanks
The couple of lines of code below works as intended:
dim somestring as string
somestring = reader("eventname").ToString
(the data element 'eventname' is defined as a text field in the database)
however
dim somestring as string
somestring = reader.getstring("eventname")
throws the error "conversion from string 'eventname' to integer is not valid"
The msdn documentation states: OleDbDataReader.GetString Method
Gets the value of the specified column as a string
syntax:
Public Overrides Function GetString (ordinal As Integer) As String
My app works fine but I would have thought that .getstring would return a string that could be assigned to a string variable?
Perhaps I'm missing something obvious, but would appreciate any clarification.
Thanks