|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Bitmap bmp = new Bitmap(ms) gives "Paramter used is invalid" exception
I'm trying to access jpeg image from ms access database. I m working in visual studio.net 2005. Here is my code:
string connectionString = "provider=Microsoft.Jet.OLEDB.4.0;" + @"data source=D:\\image\db.mdb"; OleDbConnection connection2 = new OleDbConnection(connectionString); string commandString = "Select Image from img where ImageCode = 1"; OleDbCommand command2 = new OleDbCommand(commandString, connection2); connection2.Open(); OleDbDataReader dr = command2.ExecuteReader(); dr.Read(); byte[] imgbyte = (byte[])dr["Image"]; int offset = 78; MemoryStream ms = new MemoryStream(); ms.Write(imgbyte, offset, imgbyte.Length - offset); Bitmap bmp = new Bitmap(ms); bmp.Save(Response.OutputStream, ImageFormat.Jpeg); ms.Close(); connection2.Close(); But i m getting "Parameter is invalid" error at: Bitmap bmp = new Bitmap(ms) Please help me to solve this..I will be higly obliged... |
![]() |
| Viewing: ASP Free Forums > DevSource > C# programming > Bitmap bmp = new Bitmap(ms) gives "Paramter used is invalid" exception |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|