Disney web site - 372 CHAPTER 12 CASE STUDY: USING .NET

372 CHAPTER 12 CASE STUDY: USING .NET FOR AN XML APPLICATION Note I could have handled the addition of news items using a FormView control that links to the GridView. However, I find it just as easy to use a separate page to add content to the database. As with other pages that use the template.master master page, all content for the page exists within the Content control. This contains the Add Newsbutton: You saw the click handler addNewsearlier. The page also includes a Label control for displaying error messages arising from updates. It then includes an AccessDataSource control called NewsDS. The opening tag of this control follows: The code sets the DataSourceMode property to DataSet so that users can sort the GridView. The AccessDataSource control draws content from the news.mdb database using the SQL statement contained within the SelectCommandproperty. The code also specifies two additional SQL commands: UpdateCommand and DeleteCommand. These commands specify which SQL statement to run when users click the Update or Deletelinks. The UpdateCommand attribute refers to an UPDATE statement. Notice that the code uses the wildcard character ? to specify that it will receive update parameters. The @newsID placeholder specifies the newsID from the current row. The DeleteCommand refers to a DELETE query that also uses @newsID. Because the UPDATESQL command contains parameters, the page must include an section within the control: Each parameter contains a Name property. The page uses this property when binding a GridView to the AccessDataSource component. The UpdateParameters values are bound to the columns with the same name as those specified in the Nameproperty. The parameters also specify a Type that specifies the data type of each parameter.
We recommend high quality webhost to host and run your jsp application: christian web host services.

Leave a Reply