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

First overload: using a Northwind.Entities.Tables.dbo.Categories instance:

private void AddButton_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.CategoryName = CategoryTextBox.Text.Trim();
 entity.Description = DescriptionTextBox.Text.Trim();
            
  ImageConverter converter = new ImageConverter();

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

 }


Second overload: using parameters:

private void AddButton_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.Add(CategoryTextBox.Text.Trim(),DescriptionTextBox.Text.Trim(), 
  (byte[])converter.ConvertTo(ImagePictureBox.Image, typeof(byte[])));

 LoadCategories();

 }

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