This project is read-only.
You can use one of two overloads of method Update; Passing a Entity or the corresponding parameters.
This example also shows how to update an image into database:

First overload : using a Northwind.Entities.Tables.dbo.Categories instance
private void UpdateButton_Click(object sender, EventArgs e)
{
  Northwind.Business.Tables.dbo.Categories entities = new 
  Northwind.Business.Tables.dbo.Categories();
  Northwind.Entities.Tables.dbo.Categories entity = new   
  Northwind.Entities.Tables.dbo.Categories();
  entity.CategoryID  =  Convert.ToInt16(CategoryLabel.Text);
  entity.CategoryName  = CategoryTextBox.Text;
  entity.Description = DescriptionTextBox.Text;
  ImageConverter converter = new ImageConverter();

  entity.Picture = 
  (byte[])converter.ConvertTo(ImagePictureBox.Image, typeof(byte[]));

  entities.Update(entity);
  LoadCategories();
}

Second overload: passing parameters

private void UpdateButton_Click(object sender, EventArgs e)
{
  Northwind.Business.Tables.dbo.Categories entities = new 
  Northwind.Business.Tables.dbo.Categories();
  ImageConverter converter = new ImageConverter();

  entity.Picture = 
  (byte[])converter.ConvertTo(ImagePictureBox.Image, typeof(byte[]));
  entities.Update(Convert.ToInt64(LabelId.Text),CategoryTextBox.Text.Trim(),
  DescriptionTextBox.Text.Trim(), (byte[])
  converter.ConvertTo(ImagePictureBox.Image, typeof(byte[])));              
  LoadCategories();
}

Last edited Dec 2, 2015 at 12:24 AM by cdcespon, version 4