Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rich Text to SQL Server 1

Status
Not open for further replies.

SqueakinSweep

Programmer
Jun 20, 2002
945
GB
This isnt a problem as such, more a desire for a more elegant solution to a problem.
I have a Rich Text Box, and Im able to strip the contents and store it in a SQL Table, as an Image Field.

This is the code I use to do this..
Code:
'My Class for SQL->.Net Binary Type Translations
Dim o As New fwClasses.clsGraphics
'Save RTF to Disk File
xrt.SaveFile("temp.rtf")
'Read File to Byte Array
Dim b As Byte() = o.zGetFileasByteArray("temp.rtf")
'Save Image (Id,Name,Binary Data)
Dim iTemp As Integer = osql.zSaveImage(0, "RTFNEW", b)

What I would like to do is to skip the step of saving the Richtextbox contents as a file, and hopefully use a stream instead, but Im puzzled as to how to do this.

Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Its ok...I wasnt thinking straight...its as easy as this in the end.
Code:
Dim en As New System.Text.ASCIIEncoding
Dim b() As Byte = en.GetBytes(xrt.Rtf)


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
give yourself a star then, Oh right oyu can't so I will.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top