We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to perform CRUD operations with ASP SqlDataSource?

Platform: ASP.NET Web Forms |
Control: Grid |
Published Date: February 13, 2017 |
Last Revised Date: February 13, 2017
Tags: grid, crud

The SqlDataSource is used to access data that is in relational database. The Grid fetches the data based on the SELECT command of the ASP SqlDataSource control.

We will see in detail on how to perform CRUD operations directly to database using asp sqlDataSource


We can achieve the above requirement by using the InsertCommand, UpdateCommand and DeleteCommand properties of the asp SqlDataSource.


In the following example, we have rendered a grid with CRUD enabled.

  1. Render the grid




  1. Using the InsertCommand, UpdateCommand and DeleteCommand properties of the sqlDataSource, write the sql command corresponding to insert, update and delete operation in grid



We can pass the parameters corresponding to insert and update operations using the Insertparameters and UpdateParameters properties of the SqlDataSource.

Note: If the IsIdentity property for a column is set in the database, it is not necessary to define the column within the InsertCommand property as the column value will be automatically generated and thus will conflict with the value we pass. 

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
You must log in to leave a comment
Jurica Banic
Dec 06, 2017


I am not really clear how this is suppose to work? Noting happens whit this. New record is added to grid only but not saved to database. What I am missing?

Not also sure why you are binding data to grid on a page load? this.Grid even does not exist.

You're help would be apreciated as I would like to use SqlDataSource for CRUD operations.



Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon