Uploading Picture to Database - Error

  • Thread starter Thread starter Gabe Matteson
  • Start date Start date
G

Gabe Matteson

'GRAB CONTENTS OF UPLOADED FILEDim intFileLen as Integer Dim objStream as
streamintfilelen = txtfileupload.PostedFile.ContentLength Dim
arrFile(intFileLen) as ByteobjStream =
txtfileupload.PostedFile.InputStreamobjStream.Read(arrFile, 0,
intFileLen)'INSERT DATA INTO DATABASEDim objSQLConn As SqlConnectionDim
strSQL As SqlCommandobjSQLConn = New
SqlConnection("server=srvdb1.rrg.local;uid=rsusr;pwd=Letmein123;database=rsdb")strSQL
= New SqlCommand("insert into rsdata (thumbs,fname,lname,nname)
values(@thumbs,@fname,@lname,@nname)",
objSQLConn)strSQL.Parameters.AddWithValue("@thumbs",
arrFile)strSQL.Parameters.AddWithValue("@fname",
txtfname.Text)strSQL.Parameters.AddWithValue("@lname",
txtlname.Text)strSQL.Parameters.AddWithValue("@nname",
txtnname.Text)objSQLConn.Open()strSQL.ExecuteNonQuery ()objSQLConn.Close()I
get the error - String or binary data would be truncated. and it highlights
strSQL.ExecuteNonQuery(). Any ideas? thank you. I am trying to upload a
graphic to a SQL 2000 database, the database colum is set to 2000 length and
varbinary. Thank you for any help.
 
fixed! only that, when the image is displayed on the web page, its all
binary.... and im using response.binarywrite(objdatareader(2))
 

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

Back
Top