S
Shawn
Hi. I'm letting the users upload images into a sybase 12.5 database. The
problem is that when ContentLength exceeds 131 071 an exception occur. The
e.Message property is empty so it doesn't tell me much. I know that images
much larger than this exist in the database. Any help is appreciated! Here
is my code:
Dim cn As New Connection
Dim oleDbCommand As OleDbCommand
Dim strSqlImage As String
Dim stream As System.IO.Stream = textBoxImage.PostedFile.InputStream
Dim intFileLength As Integer = textBoxImage.PostedFile.ContentLength
Dim byteArray(intFileLength) As Byte
cn.Open()
stream.Read(byteArray, 0, intFileLength)
strSqlImage = "UPDATE TABLE1 SET image = ? WHERE id = " & intID
oleDbCommand = New OleDbCommand(strSqlImage, cn.oleDbConnection)
oleDbCommand.Parameters.Add(New OleDbParameter("@image",
OleDbType.LongVarBinary)).Value = byteArray
oleDbCommand.ExecuteNonQuery()
problem is that when ContentLength exceeds 131 071 an exception occur. The
e.Message property is empty so it doesn't tell me much. I know that images
much larger than this exist in the database. Any help is appreciated! Here
is my code:
Dim cn As New Connection
Dim oleDbCommand As OleDbCommand
Dim strSqlImage As String
Dim stream As System.IO.Stream = textBoxImage.PostedFile.InputStream
Dim intFileLength As Integer = textBoxImage.PostedFile.ContentLength
Dim byteArray(intFileLength) As Byte
cn.Open()
stream.Read(byteArray, 0, intFileLength)
strSqlImage = "UPDATE TABLE1 SET image = ? WHERE id = " & intID
oleDbCommand = New OleDbCommand(strSqlImage, cn.oleDbConnection)
oleDbCommand.Parameters.Add(New OleDbParameter("@image",
OleDbType.LongVarBinary)).Value = byteArray
oleDbCommand.ExecuteNonQuery()