Click here to Skip to main content
15,912,507 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to wrapping software Pin
Rajdeep.NET is BACK27-May-09 20:22
Rajdeep.NET is BACK27-May-09 20:22 
Questionhow to get the mouse clicked location?? Pin
Hema Bairavan27-May-09 5:07
Hema Bairavan27-May-09 5:07 
AnswerRe: how to get the mouse clicked location?? Pin
J4amieC27-May-09 5:20
J4amieC27-May-09 5:20 
AnswerRe: how to get the mouse clicked location?? Pin
DaveyM6927-May-09 5:20
professionalDaveyM6927-May-09 5:20 
QuestionReading a wiki page Pin
michael@cohen27-May-09 3:52
michael@cohen27-May-09 3:52 
AnswerRe: Reading a wiki page Pin
EliottA27-May-09 4:10
EliottA27-May-09 4:10 
AnswerRe: Reading a wiki page Pin
Fired.Fish.Gmail27-May-09 4:26
Fired.Fish.Gmail27-May-09 4:26 
Questionimage stroing problem from the class property Pin
maifs27-May-09 3:11
maifs27-May-09 3:11 
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
{

con.Close();
}


}
}


public partial class ManageItemsForm : BaseForm
{
Item itm;
ItemsDAL itemDal = new ItemsDAL();

MemoryStream mem = new MemoryStream();
public ManageItemsForm()
{
InitializeComponent();
itm = new Item();


}

private void selectImageToolStripMenuItem_Click(object sender, EventArgs e)
{


DialogResult r = this.openFileDialog1.ShowDialog(this);
if (r == DialogResult.OK)
{

pbxItem.Image = Image.FromFile(openFileDialog1.FileName);
this.pbxItem.BorderStyle = BorderStyle.None;
}
}

private void tabPage1_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
itm.Photo = mem.GetBuffer();
itemDal.InserItem();
this.pbxItem.Image.Save(mem, this.pbxItem.Image.RawFormat);
Dotnet67.Sales.Persons.Customer c = new Dotnet67.Sales.Persons.Customer();
c.Name = txtName.Text;


}

}

Maifs

AnswerRe: image stroing problem from the class property Pin
padmanabhan N27-May-09 3:20
padmanabhan N27-May-09 3:20 
GeneralRe: image stroing problem from the class property Pin
maifs27-May-09 9:24
maifs27-May-09 9:24 
GeneralRe: image stroing problem from the class property Pin
Troy Russell27-May-09 9:35
Troy Russell27-May-09 9:35 
RantRe: image stroing problem from the class property Pin
Troy Russell27-May-09 9:39
Troy Russell27-May-09 9:39 
GeneralRe: image stroing problem from the class property Pin
EliottA27-May-09 9:46
EliottA27-May-09 9:46 
GeneralRe: image stroing problem from the class property Pin
maifs27-May-09 10:02
maifs27-May-09 10:02 
GeneralRe: image stroing problem from the class property Pin
EliottA27-May-09 10:04
EliottA27-May-09 10:04 
GeneralRe: image stroing problem from the class property Pin
maifs27-May-09 10:09
maifs27-May-09 10:09 
GeneralRe: image stroing problem from the class property Pin
EliottA27-May-09 10:10
EliottA27-May-09 10:10 
GeneralRe: image stroing problem from the class property Pin
maifs27-May-09 10:24
maifs27-May-09 10:24 
GeneralRe: image stroing problem from the class property Pin
EliottA27-May-09 10:31
EliottA27-May-09 10:31 
GeneralRe: image stroing problem from the class property Pin
maifs27-May-09 10:33
maifs27-May-09 10:33 
QuestionRajdeep.net or whatever the hell your name is. PinPopular
EliottA27-May-09 2:57
EliottA27-May-09 2:57 
AnswerRe: Rajdeep.net or whatever the hell your name is. PinPopular
J4amieC27-May-09 3:15
J4amieC27-May-09 3:15 
GeneralRe: Rajdeep.net or whatever the hell your name is. Pin
Troy Russell27-May-09 10:12
Troy Russell27-May-09 10:12 
GeneralRe: Rajdeep.net or whatever the hell your name is. Pin
Dave Kreskowiak27-May-09 10:27
mveDave Kreskowiak27-May-09 10:27 
AnswerRe: Rajdeep.net or whatever the hell your name is. Pin
PIEBALDconsult27-May-09 4:43
mvePIEBALDconsult27-May-09 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.