Hi
i want to save image from picturebox into sql but i got the error 'ARTHEMATIC OPERATIONS RESULTED IN AN OVERFLOW' On line
bytBLOBData = New Byte() {ms.Length}
here is my code
sqlConnection = New SqlClient.SqlConnection(sConnectionString)
sqlCommand = New SqlClient.SqlCommand("INSERT INTO BLOBTest (BLOBData) VALUES (@BLOBData)", sqlConnection)
'//Save image from PictureBox into MemoryStream object.
ms = New MemoryStream()
PictureBox1.Image.Save(ms, ImageFormat.Jpeg)
'//Read from MemoryStream into Byte array.
bytBLOBData = New Byte() {ms.Length} // ERROR IS HERE
ms.Position = 0
ms.Read(bytBLOBData, 0, Convert.ToInt32(ms.Length))
'//Create parameter for insert statement that contains image.
prm = New SqlClient.SqlParameter("@BLOBData", SqlDbType.VarBinary, bytBLOBData.Length, ParameterDirection.Input, False, 0, 0, "BLOBData", DataRowVersion.Current, bytBLOBData)
sqlCommand.Parameters.Add(prm)
sqlConnection.Open()
sqlCommand.ExecuteNonQuery()
sqlConnection.Close()
PLEASE GIVE ME SOME SOLUTION
VARINDER