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. General Programming
  3. C#
  4. image stroing problem from the class property

image stroing problem from the class property

Scheduled Pinned Locked Moved C#
helpdatabase
13 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.
  • M Offline
    M Offline
    maifs
    wrote on last edited by
    #1

    i am trying to store a image in sqlserver database, but doesnt effect. help me. public class Item { private int code; private string name; private float price; private Category category; private byte[] photo; public Item() { } public Item(int code, string name) { this.Code = code; this.Name = name; } public Item(int code, string name, float price) : this(code,name) { this.Price = price; } public int Code { get { return this.code; } set { this.code = value; } } public string Name { get { return this.name; } set { this.name = value; } } public float Price { get { return this.price; } set { this.price = value; } } public Category Category { get { return this.category; } set { this.category = value; } } public byte[] Photo { get { return this.photo; } set { this.photo = value; } } } public class ItemsDAL { private string selectItemByCode = "Select * from ItemsWithCategory where code=@code"; private string selectAllItems = "Select * from ItemWithCategory"; // View private string insertItem = "InsertImage"; public void InserItem(Item pic) { SqlConnection con = new SqlConnection(DALHelper.ConnectionString); SqlCommand cmd = new SqlCommand(this.insertItem,con); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = this.insertItem; cmd.Parameters.Add(new SqlParameter("@photo", pic.Photo)); con.Open(); try { cmd.Parameters["@photo"].Value = pic.Photo; cmd.ExecuteNonQuery(); } finally {

    P 1 Reply Last reply
    0
    • M maifs

      i am trying to store a image in sqlserver database, but doesnt effect. help me. public class Item { private int code; private string name; private float price; private Category category; private byte[] photo; public Item() { } public Item(int code, string name) { this.Code = code; this.Name = name; } public Item(int code, string name, float price) : this(code,name) { this.Price = price; } public int Code { get { return this.code; } set { this.code = value; } } public string Name { get { return this.name; } set { this.name = value; } } public float Price { get { return this.price; } set { this.price = value; } } public Category Category { get { return this.category; } set { this.category = value; } } public byte[] Photo { get { return this.photo; } set { this.photo = value; } } } public class ItemsDAL { private string selectItemByCode = "Select * from ItemsWithCategory where code=@code"; private string selectAllItems = "Select * from ItemWithCategory"; // View private string insertItem = "InsertImage"; public void InserItem(Item pic) { SqlConnection con = new SqlConnection(DALHelper.ConnectionString); SqlCommand cmd = new SqlCommand(this.insertItem,con); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = this.insertItem; cmd.Parameters.Add(new SqlParameter("@photo", pic.Photo)); con.Open(); try { cmd.Parameters["@photo"].Value = pic.Photo; cmd.ExecuteNonQuery(); } finally {

      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #2

      refer : GridView all in one[^] //in this i have stored image and retrived in grid and also in another page. Download the sample project and see.

      Padmanabhan

      M 1 Reply Last reply
      0
      • P padmanabhan N

        refer : GridView all in one[^] //in this i have stored image and retrived in grid and also in another page. Download the sample project and see.

        Padmanabhan

        M Offline
        M Offline
        maifs
        wrote on last edited by
        #3

        but i dont have to save in grid view. i want to keep it in separate for single person

        Maifs

        L 2 Replies Last reply
        0
        • M maifs

          but i dont have to save in grid view. i want to keep it in separate for single person

          Maifs

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          :omg:   :omg: :mad::mad::mad::mad: :|   :|   :|   :|   X|   X|   X|   X| :suss::suss::suss::suss::suss::suss::cool::cool::cool::cool::cool::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsdown::thumbsdown::thumbsdown::thumbsdown::thumbsup:Ola,    Que pasa.   No tengo yo mas o mucho experiencia ahorita.   Los todos son mi problema,   estoy bueno o no???                            :laugh:   ;P   ;P   :^)   :^)   :sigh:   :sigh:   :sigh:   :((   :zzz:   :rolleyes:   :rolleyes:   :rolleyes:   :rolleyes:   :rolleyes:

          1 Reply Last reply
          0
          • M maifs

            but i dont have to save in grid view. i want to keep it in separate for single person

            Maifs

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            :omg:   :omg: :mad::mad::mad::mad: :|   :|   :|   :|   X|   X|   X|   X| :suss::suss::suss::suss::suss::suss::cool::cool::cool::cool::cool::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsdown::thumbsdown::thumbsdown::thumbsdown::thumbsup:Ola,    Que pasa.   No tengo yo mas o mucho experiencia ahorita.   Los todos son mi problema,   estoy bueno o no???                <a href=""></a>            :laugh:   ;P   ;P   :^)   :^)   :sigh:   :sigh:   :sigh:   :((   :zzz:   :rolleyes:   :rolleyes:   :rolleyes:   :rolleyes:   :rolleyes:

            L 1 Reply Last reply
            0
            • L Lost User

              :omg:   :omg: :mad::mad::mad::mad: :|   :|   :|   :|   X|   X|   X|   X| :suss::suss::suss::suss::suss::suss::cool::cool::cool::cool::cool::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsdown::thumbsdown::thumbsdown::thumbsdown::thumbsup:Ola,    Que pasa.   No tengo yo mas o mucho experiencia ahorita.   Los todos son mi problema,   estoy bueno o no???                <a href=""></a>            :laugh:   ;P   ;P   :^)   :^)   :sigh:   :sigh:   :sigh:   :((   :zzz:   :rolleyes:   :rolleyes:   :rolleyes:   :rolleyes:   :rolleyes:

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              My eyes, stop it please.

              Check out the CodeProject forum Guidelines[^]

              M 1 Reply Last reply
              0
              • L Lost User

                My eyes, stop it please.

                Check out the CodeProject forum Guidelines[^]

                M Offline
                M Offline
                maifs
                wrote on last edited by
                #7

                what you mean?

                Maifs

                L 1 Reply Last reply
                0
                • M maifs

                  what you mean?

                  Maifs

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  My response was to Tory Russel, not you. His post was damaging to the eyes.

                  Check out the CodeProject forum Guidelines[^]

                  M 1 Reply Last reply
                  0
                  • L Lost User

                    My response was to Tory Russel, not you. His post was damaging to the eyes.

                    Check out the CodeProject forum Guidelines[^]

                    M Offline
                    M Offline
                    maifs
                    wrote on last edited by
                    #9

                    ok but if can reply my post then do it.

                    Maifs

                    L 1 Reply Last reply
                    0
                    • M maifs

                      ok but if can reply my post then do it.

                      Maifs

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      Try asking in the ASP.NET[^] forum, you might have better luck.

                      Check out the CodeProject forum Guidelines[^]

                      M 1 Reply Last reply
                      0
                      • L Lost User

                        Try asking in the ASP.NET[^] forum, you might have better luck.

                        Check out the CodeProject forum Guidelines[^]

                        M Offline
                        M Offline
                        maifs
                        wrote on last edited by
                        #11

                        is there no one which can reply me?

                        Maifs

                        L 1 Reply Last reply
                        0
                        • M maifs

                          is there no one which can reply me?

                          Maifs

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #12

                          No, I am not experienced enough in ASP.NET / Sql to help you out. In the ASP.NET forum you will find more help.

                          Check out the CodeProject forum Guidelines[^]

                          M 1 Reply Last reply
                          0
                          • L Lost User

                            No, I am not experienced enough in ASP.NET / Sql to help you out. In the ASP.NET forum you will find more help.

                            Check out the CodeProject forum Guidelines[^]

                            M Offline
                            M Offline
                            maifs
                            wrote on last edited by
                            #13

                            thx

                            Maifs

                            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