Home / silverdatingagency co uk / Inserting updating and deleting data with the objectdatasource

Inserting updating and deleting data with the objectdatasource kent state dating

User ID, First Name and Last Name are template columns and Edit and Delete columns are Command Columns which are added using smart tag option (You can view the smart tag if you right click on the Grid View control).string str Connection = "Server=abc\SQLEXPRESs; Database=Employee; Trusted_Connection=True"; Sql Connection con = new Sql Connection(str Connection); con.Here’s a quick and easy process to get started doing that.I’m assuming that you already have some sort of working database, and that you’ve created a Data Context (i.e. (You know, dragging and dropping those tables, which just takes much work.) If you didn’t know what all was going on in the background, then I don’t blame you.These are the tools that provide data to the data bound controls and support execution of operations like insertions, deletions, sorting, and updates.

There are several ways to perform these operations, I am using the simplest approach.

It’s pretty good for testing purposes, or really small projects, but if you’re doing anything that is going to grow / is large already, then you’ll probably not want all that logic embedded in your pages.

As I became more comfortable with LINQ, I decided to take on the task of switching over to the Object Data Source to bind to my List Views.

The short version of it is that it’s generating a bunch of classes to match the tables in the database.

It’s pretty awesome if you ever get into the details, but for the purposes of this tutorial, we’ll just stick to that. That allows us to mark the class as a Data Object, which just organizes it better and makes the data source wizard easier to work with.

27 comments

  1. The ObjectDataSource Control enables user-defined classes to associate the output of their methods to data bound controls. The bindable class should have a default constructor, it should be stateless, and have methods that can be mapped to select, update, insert, and delete semantics. The object must update one item.

  2. It provides the advantage of separating the business logic and the data access logic. The ObjectDataSource can be bound to controls such as DropDownList, GridView, DetailsView and FormView. The various operations such as Select, Insert, Update and Delete can be performed using the ObjectDataSource control.

Leave a Reply

Your email address will not be published. Required fields are marked *

*