image stroing problem from the class property
-
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 {
-
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 {
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
-
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
-
: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:
-
: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:
-
: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:
-
My eyes, stop it please.
-
My response was to Tory Russel, not you. His post was damaging to the eyes.