Getvalue not returning all characters in reader

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am using

cstr(MyReader.GetValue(MyReader.GetOrdinal("MyField")))

to get a string value from a oledb reader. Problem is GetValue or even
GetString only seem to return only first 255 characters of the MyField
column. How can I get more than 255 characters?

Thanks

Regards
 
Create a New DataTable and use "MyDataTable.Load MyDataReader" and stop
frutzing with the details?

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________
 
Hi

I have used below but still no luck. Only 255 characters are returned from
the underlying access memo field. Any ideas?

Dim DT As DataTable = New DataTable
Dim Comm As OleDbCommand
Dim Reader1 As OleDb.OleDbDataReader
Comm = New OleDbCommand("SELECT ... FROM ... WHERE ....", dbCon)
Reader1 = Comm.ExecuteReader
DT.Load(Reader1)

MsgBox(DT.Rows.Item(0).Item(25).ToString)

Thanks

Regards
 
If it's a BLOB I expect you'll need to use the CommandBehavior that returns
streams.

Dim cmd2 As New OleDbCommand("Select blob from Table", cn2)
Dim dr2 As OleDb.OleDbDataReader
dr2 = cmd2.ExecuteReader(CommandBehavior.SequentialAccess)

Hth.
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________
 
Back
Top