Creating CRUD Windows Form Vs 2015 C# Sample in C# For Visual Studio 2015
Creating CRUD Windows Form Vs 2015 C# Sample in C# For Visual Studio 2015
Creating CRUD windows form vs 2015 C# sample in C# for Visual Studio 2015
Developer resources
Explore
Docs
Downloads
Samples
Support
Dev Center - Desktop > Samples > Creating CRUD windows form vs 2015 C#
this is a CRUD form c# with entity framwork and linq querythis needes vistual studio 2015 Enterprisesql server 2012 or
anyDescriptionscreenshotthe following screenshot show CRUD / insertion, update, delete with images into the sql server databasethe da
file in inde ziped f
Quick access
My samples
Upload a sample
Download
C# (4.7 MB)
170
Points
Top 10%
Hassan-kafi A. Mohamed
Ratings
(0)
Updated
12/15/2015
Downloaded
1,228 times
License
MIT
Favorites
Add to favorites
Share
Requires
Technologies
LINQ to SQL, Entity Framework, C# programming, CRUD with images into the sqlserver c#
Topics
Show activity
Description
Browse code
Q and A
Introduction
this is a CRUD form c# with entity framwork and linq query
Description
screenshot
the following screenshot show CRUD / insertion, update, delete with images into the sql server database
the database file in inde ziped file.
so you can download copy pate into new query window of the sql server then excute.
the following screenshot show CRUD / insertion, update, delete with images into the sql server database
the database file in inde ziped file.
so you can download copy pate into new query window of the sql server then excute.
the following screenshot show CRUD / insertion, update, delete with images into the sql server database
the database file in inde ziped file.
so you can download copy pate into new query window of the sql server then excute.
the following screenshot show CRUD / insertion, update, delete with images into the sql server database
the database file in inde ziped file.
so you can download copy pate into new query window of the sql server then excute.
https://code.msdn.microsoft.com/windowsdesktop/Creating-CRUD-application-1b0028e5
1/5
11/10/2016
Creating CRUD windows form vs 2015 C# sample in C# for Visual Studio 2015
the following screenshot show CRUD / insertion, update, delete with images into the sql server database
the database file in inde ziped file.
so you can download copy pate into new query window of the sql server then excute.
the following screenshot show CRUD / insertion, update, delete with images into the sql server database
the database file in inde ziped file.
so you can download copy pate into new query window of the sql server then excute.
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace CRUD_app
{
public partial class Form1 : Form
{
employeeDataContext ed;
string imagename;
public Form1()
{
InitializeComponent();
ed = new employeeDataContext();
}
private void Form1_Load(object sender, EventArgs e)
{
}
https://code.msdn.microsoft.com/windowsdesktop/Creating-CRUD-application-1b0028e5
2/5
11/10/2016
Creating CRUD windows form vs 2015 C# sample in C# for Visual Studio 2015
//a byte array to read the image
byte[] picbyte = new byte[fs.Length];
fs.Read(picbyte, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
empTable.empid = textBox1.Text;
empTable.empname = textBox2.Text.ToString();
empTable.empdep = textBox3.Text.ToString();
empTable.empimage = picbyte;
ed.employeetabs.InsertOnSubmit(empTable);
ed.SubmitChanges();
MessageBox.Show("Record Inserted Successfully");
}
}
else MessageBox.Show("Record allready existing");
}
// Data Binding
foreach (var emp in empresult)
{
MemoryStream stream = new MemoryStream();
https://code.msdn.microsoft.com/windowsdesktop/Creating-CRUD-application-1b0028e5
3/5
11/10/2016
Creating CRUD windows form vs 2015 C# sample in C# for Visual Studio 2015
//a byte array to read the image
byte[] picbyte = new byte[fs.Length];
fs.Read(picbyte, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
emp.empimage = picbyte;
ed.SubmitChanges();
imagename = "";
}
MessageBox.Show("Record Updated");
}
private void button4_Click(object sender, EventArgs e)
{
try
{
FileDialog fldlg = new OpenFileDialog();
//specify your own initial directory
fldlg.InitialDirectory = @"C:\";
//this will allow only those file extensions to be added
fldlg.Filter = "Image File (*.jpg;*.bmp;*.gif)|*.jpg;*.bmp;*.gif";
if (fldlg.ShowDialog() == DialogResult.OK)
{
imagename = fldlg.FileName;
//Bitmap newimg = new Bitmap(imagename);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = Image.FromFile(imagename);
}
fldlg = null;
}
catch (System.ArgumentException ae)
{
imagename = " ";
MessageBox.Show(ae.Message.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
{
}
private void cmdClear_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
}
}
}
More Information
For more information on this , contact and ask to me Hassan-kafi A. Mohamed
https://code.msdn.microsoft.com/windowsdesktop/Creating-CRUD-application-1b0028e5
4/5
11/10/2016
Creating CRUD windows form vs 2015 C# sample in C# for Visual Studio 2015
Essentials
Learning resources
Programs
Visual Studio
Channel 9
Windows SDK
Code samples
Video gallery
English
https://code.msdn.microsoft.com/windowsdesktop/Creating-CRUD-application-1b0028e5
Terms of use
Trademarks
5/5