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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to save a Posted File to Text, Ntext in SQL?

Status
Not open for further replies.

JonathanC

Programmer
Oct 24, 2001
35
0
0
US
I have a problem with saving a posted file to the database as a text column.

I know that array of bytes easily can be saved to an image field to the sql by using the sql parameter with type images. I tried this to a text file by just changing it to text and gives me an error...

Public Sub FileUpload(ByVal FileID As Integer, ByVal FileType As String, ByVal FileContents() As Byte, ByVal FileSize As Long)

Dim parameterFileContent As New SqlParameter("@FileContents", SqlDbType.IMAGE, FileSize)
parameterFileContent.Value = FileContents

================================================
that one works perfectly but if i used SQLDBTYPE.TEXT instead of sqldbtype.image,

I received an error that says: Object must implement IConvertible....


Any suggestions...thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top