Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. System.ArgumentException: Parameter is not valid.

System.ArgumentException: Parameter is not valid.

Scheduled Pinned Locked Moved ASP.NET
helpdatabasecsharpasp-netgraphics
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nudma
    wrote on last edited by
    #1

    Hi All!! I am trying to display image from database on Asp.Net 2.0 Framework..But my problem is unsolved...The code is: protected void Button1_Click(object sender, EventArgs e) { 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(); byte[] m_objBitmap = (byte[])(command2.ExecuteScalar()); ; connection2.Close(); Bitmap BitmapData = BmpDataFromBitmap(m_objBitmap); MemoryStream ms = new MemoryStream(); Response.ContentType = "image/jpeg"; BitmapData.Save(ms,ImageFormat.Jpeg); ms.Close(); } static public Bitmap BmpDataFromBitmap(byte[] BitmapData) { MemoryStream ms = new MemoryStream(BitmapData); return (new Bitmap(ms)); }

    But i get error "Parameter is invalid" at line:

    return (new Bitmap(ms)); I need your kind help..thanx!!

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups