If you insert a record, the Details View automatically populates the collection with values from the bound columns and calls the Insert method.The Details View can infer the correct parameters from any Bound Field object and a parameter for the Template Field object when the ASP. In this example, an additional parameter is added in the On Inserting event handler to handle the primary key that is returned by the stored procedure. I have a Transactions table which stores individual items that the user selects for purchase (item name, item price, order ID, etc) I have an Orders table which stores values for the Order (account name, order total, etc) Here is my Sql Data Source as defined in the page: " Insert Command="INSERT INTO [tbl Orders] ([Order Date], [Order Total], [Order Account], [Order Cost Centre]) VALUES (@Order Date, @Order Total, @Order Account, @Order Cost Centre); SELECT @Order New ID = SCOPE_IDENTITY()" Select Command="SELECT * FROM [tbl Orders]" Update Command="UPDATE [tbl Orders] SET [Order Date] = @Order Date, [Order Total] = @Order Total, [Order Account] = @Order Account, [Order Cost Centre] = @Order Cost Centre WHERE [Order ID] = @original_Order ID AND [Order Date] = @original_Order Date AND [Order Total] = @original_Order Total AND [Order Account] = @original_Order Account AND [Order Cost Centre] = @original_Order Cost Centre" Old Values Parameter Format String="original_" oninserting="Sql Data Source2_Inserting" oninserted="Sql Data Source2_Inserted" onupdated="Sql Data Source2_Updated" onupdating="Sql Data Source2_Updating" //Update Order Table with Total of Order //Sql Data Source2. Update(); The page doesn't error out, but the Update to Order Total in the Orders Db doesn't update. Or, tap into the Updating event, and add the new value to the event argument collection of values. If you click the automatically generated Insert button of the Details View control, the Details View shows a different user interface, which is used to insert a new record.The example uses a stored procedure to insert records and returns the primary key of the inserted row.Optimistic concurrency is a database strategy that protects against losing changes at a data source in scenarios where multiple users are manipulating the data at the same time.
The Grid View and Details View controls use different data source controls; the one that is associated with the Details View has the properties, which ensure that the selected row of the Grid View is displayed.
providers that do not support named parameters in SQL statements and instead use the '? In those cases you should define parameters in the order specified in the associated SQL statement.
events before it executes the SQL statement for the corresponding command property.
Parameters are used to send values for insert, update, and delete operations to the data source.
Parameter names and values are based on data fields bound to a control or alternatively on parameter objects that you define explicitly.