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.
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.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
|7423||02/13/2017||02/13/2017||ASP.NET Web Forms||Grid|