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. Database & SysAdmin
  3. Database
  4. image datatype

image datatype

Scheduled Pinned Locked Moved Database
csharpquestion
3 Posts 3 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.
  • T Offline
    T Offline
    TAREQ F ABUZUHRI
    wrote on last edited by
    #1

    i create new table and have feild from type image and allow null in my program i want to ck if this field is fill or empity ?? i use c# ,,,

    Palestine

    T P 2 Replies Last reply
    0
    • T TAREQ F ABUZUHRI

      i create new table and have feild from type image and allow null in my program i want to ck if this field is fill or empity ?? i use c# ,,,

      Palestine

      T Offline
      T Offline
      T EDY
      wrote on last edited by
      #2

      i try this in my code and its working fine, ex : byte[] img = (searchContact["Photo"] == DBNull.Value) ? null : (byte[])searchContact["Photo"]; searchContact is my SqlDataReader, Hope this can solve u'r problems

      Best Regards, Tomi

      1 Reply Last reply
      0
      • T TAREQ F ABUZUHRI

        i create new table and have feild from type image and allow null in my program i want to ck if this field is fill or empity ?? i use c# ,,,

        Palestine

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        I've used variants of the following public static T GetData<T>(IDataReader rdr, string column) { if (string.IsNullOrEmpty(column)) throw new ArgumentNullException("column"); if (rdr == null) throw new ArgumentNullException("rdr"); int pos = rdr.GetOrdinal(column); T returnValue = (rdr[pos] == DBNull.Value) ? default(T) : (T)rdr[pos]; return returnValue; } byte[]img = GetData<byte[]>(reader, "Photo"); string contact = GetData<string>(reader, "Contact"); My apologies if the syntax isn't 100% exact, but I'm typing this out from memory.

        Deja View - the feeling that you've seen this post before.

        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