Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL TEXT field to Stream?

Posted on 2007-04-10
1
Medium Priority
?
328 Views
Last Modified: 2008-01-09
I have a SQL dataset with a record that has a TEXT field containing HTML.
I want to attach the HTML from the TEXT field to a Message as AlternativeView, somethng like this...

Dim htmlBody As New AlternateView("filename.htm", "text/html")
message.AlternateViews.Add(htmlBody)

Problem: AlternativeView only accepts FILE NAMES and STREAMS. How do I convert a dataset's TEXT field into a stream. ( I do NOT want to write a file!!!)
0
Comment
Question by:volking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 2000 total points
ID: 18885957
Here you go:

      Public Function GetMemoryStream(ByVal text As String) As System.IO.MemoryStream
            Dim memStream As New System.IO.MemoryStream
            Dim data As Byte() = System.Text.Encoding.Unicode.GetBytes(text)
            memStream.Write(data, 0, data.Length)

            Return memStream
      End Function

In all fairness, I found this at http://discuss.joelonsoftware.com/default.asp?dotnet.12.365711.4
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question