Updating web content

Figure 5: Clicking the Delete Button in the Grid View Invokes the Sql Data Source s SQL statements can be specified through the Properties window or the control s declarative syntax.

Note When adding parameters that do not have corresponding fields in the data Web control, keep in mind that these parameters values will need to be assigned values in some manner.In previous tutorials we learned how the Object Data Source control allowed for inserting, updating, and deleting of data.The Sql Data Source control supports the same operations, but the approach is different, and this tutorial shows how to configure the Sql Data Source to insert, update, and delete data.Upon completing the wizard, Visual Studio will add Bound Fields to the Details View for the " Delete Command= "DELETE FROM [Products] WHERE [Product ID] = @Product ID" Insert Command= "INSERT INTO [Products] ([Product Name], [Unit Price], [Discontinued]) VALUES (@Product Name, @Unit Price, @Discontinued)" Select Command= "SELECT [Product ID], [Product Name], [Unit Price], [Discontinued] FROM [Products]" Update Command= "UPDATE [Products] SET [Product Name] = @Product Name, [Unit Price] = @Unit Price, [Discontinued] = @Discontinued WHERE [Product ID] = @Product ID".Visit the page in a browser and note the Edit, Delete, and New buttons included in the Details View.

Leave a Reply