Welcome to the FoxLearn
Today we will learn how to insert, update, delete, select in sql server
First, You need to add a DataGridView to your Form
You can use the DataGridView to display the contact list
We will design a simple UI that allows you to insert, update, delete and view data from your database
You need to add a contact detail form to insert and edit data
You need to create a new database, then add a simple contact table to the new database
You need to set the ID column is primary key and identity is true
Auto-increment allows a unique number to be generated when a new record is inserted into a table
We will use entity framework to insert, update, delete and select data from your database
Entity Framework is an object relational mapper that enables dotnet developers to work with relational data using domain-specific
It eliminates the need for most of the data-access code that developers usually need to write
You need to add a binding source to the datagridview and contact detail form
The BindingSource component serves two purposes
First, it provides a layer of indirection when binding the controls on a form to data
This is accomplished by binding the BindingSource component to your data source, and then binding the controls on your form to the BindingSource component
All further interaction with the data, including navigating, sorting, filtering, and updating, is accomplished with calls to the BindingSource component
Second, the BindingSource component can act as a strongly typed data source
Adding a type to the BindingSource component with the Add method creates a list of that type
You can add new contact object to the contact list, or cast the current contact to edit
Thank you for watching this video