GetString equivalent?

T

Tom

Is there anything in ADO.NET that is equivalent to the old ADO GetString?
This would return a record/recordset as a string.

Thanks.

Tom
 
W

William \(Bill\) Vaughn

Nope. You can extrude an XML "string", but that's not the same.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
C

Cor

Hi Tom,

Funny I did now distribute this sample that I did make in three newsgroups
in 24hours.

\\\starts with making a sample dataset.
Dim ds As New DataSet
Dim dt As New DataTable("parameters")
For c As Integer = 1 To 10
Dim dc As New DataColumn("elem" & c.tostring)
dt.Columns.Add(dc)
Next
For r As Integer = 1 To 10
Dim dr As DataRow = dt.NewRow
For c As Integer = 1 To 10
dr("elem" & c.tostring) = _
r.ToString & c.tostring ' or just dr(c) but to show you
Next
dt.Rows.Add(dr) ' can also before but I find this looking nicer
Next
ds.Tables.Add(dt)

----start of making a string from it.
Dim ser As XmlSerializer = New XmlSerializer(GetType(DataSet))
Dim ms As New IO.MemoryStream
Dim sw As IO.TextWriter = New IO.StreamWriter(ms)
ser.Serialize(sw, ds)
Dim b As Long = ms.Length
ms.Position = 0
Dim sr As IO.TextReader = New IO.StreamReader(ms)
Dim xmlstring As String = sr.ReadToEnd
sw.Close()
sr.Close()
ms.Close()
///

I hope this helps a little bit?

Cor
 

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