Getvalue not returning all characters in reader

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
 
W

William Vaughn MVP

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
____________________________________________________________________________________________
 
J

John

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
 
W

William Vaughn MVP

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
____________________________________________________________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top