HighTechTalks DotNet Forums  

datareader.getstring(0) doesn't return the whole string.

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss datareader.getstring(0) doesn't return the whole string. in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jason James
 
Posts: n/a

Default datareader.getstring(0) doesn't return the whole string. - 05-14-2007 , 02:17 AM






Hi,

I am using an Access DB and a datareader to retrieve a memo field.
When I execute the following code the datareader only ever returns the
first 255 characters, even though I have used a string builder (and a
regular string) which I believe can hold more than 255 characters. Is
there an issue with the datareader or the memo field of an access
database. If I use a dataset and an OleDBDataAdapter then all of the
characters (i.e. > 255) are read in and can be viewed in a datagrid.

Many thanks,

Jason.


Dim cmd As New OleDbCommand("SELECT tblBOMS.bBOM,
Count(tblBOMS.bBOM) AS CountOfbBOM FROM tblBOMS GROUP BY tblBOMS.bBOM
HAVING (((Count(tblBOMS.bBOM))>=2)) ORDER BY Count(tblBOMS.bBOM)
DESC;", cn4)
Dim f As New FileInfo("C:\Duplicate Boms.txt")
Dim s As StreamWriter = f.CreateText()
If cn4.State = ConnectionState.Closed Then
cn4.Open()
End If
Dim dr As OleDbDataReader =
cmd.ExecuteReader(CommandBehavior.Default)
While dr.Read
Dim str As New StringBuilder(dr.GetString(0))


s.WriteLine("===================================== ========================")
s.WriteLine(str)

s.WriteLine("===================================== ========================")

' Find all catalogue number with this BOM
Dim dv As New DataView
dv.Table = ds2.Tables("BOMS")
dv.RowFilter = "bBOM like '" & str.ToString() & "'"
Dim drv As DataRowView
For Each drv In dv
Dim strA As String = drv("bName")
s.WriteLine(strA)
Next
End While

s.Close()
s.Dispose()


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.