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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Assign byte[] to sqldatasource.insertparameter.

Assign byte[] to sqldatasource.insertparameter.

Scheduled Pinned Locked Moved ASP.NET
helpdatabasedata-structurestutorialquestion
2 Posts 2 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.
  • J Offline
    J Offline
    JacquesDP
    wrote on last edited by
    #1

    Hi, I have a formview that uses a sqldatasource. In the insert item template of the formview I have a file upload control that the user uses to upload an image to the database. Then on the click event of the insert button I take the image and push it over to a byte array so that I can insert it into the database. Then I want to update the insert sqlparameter with the byte array to be saved to the database. The problem that I'm facing is that the column type in the database table is that of image, but when i try to set the sqltype of the insert parameter there is no image option under the TypeCode enum. I can't insert the image as string nor as object cause it gives me an sqlexcpetion of converting from string to image type. The error is as follow : "Operand type clash: nvarchar is incompatible with image" Any ideas on how to get this working? Thanks in advance

    No matter how long he who laughs last laughs, he who laughs first has a head start!

    P 1 Reply Last reply
    0
    • J JacquesDP

      Hi, I have a formview that uses a sqldatasource. In the insert item template of the formview I have a file upload control that the user uses to upload an image to the database. Then on the click event of the insert button I take the image and push it over to a byte array so that I can insert it into the database. Then I want to update the insert sqlparameter with the byte array to be saved to the database. The problem that I'm facing is that the column type in the database table is that of image, but when i try to set the sqltype of the insert parameter there is no image option under the TypeCode enum. I can't insert the image as string nor as object cause it gives me an sqlexcpetion of converting from string to image type. The error is as follow : "Operand type clash: nvarchar is incompatible with image" Any ideas on how to get this working? Thanks in advance

      No matter how long he who laughs last laughs, he who laughs first has a head start!

      P Offline
      P Offline
      praveen003
      wrote on last edited by
      #2

      images are binary type so you can do this by binary format

      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