The PT application needs to query the Eval database, retrieve data from the database, and modify data in database tables. The LitWare designers assign the data retrieval tasks to viewData.asp and the database updates to postIt.asp.
The code that retrieves data can be a T-SQL SELECT statement or a call to a stored procedure. The design goal is one ASP page (viewData.asp) that can support both data access methods. This flexibility originates in the HTML that populates the right pane of each form view in the PT application. The information that viewData.asp needs is stored in hidden fields on the form and passed to viewData.asp in the ASP Request object. The hidden field is named tableName and contains the name of the Eval database table that is the subject of the data request. Additional values the SELECT statement or stored procedure needs, such as the unique identifier of the requested record, is also stored in a hidden field. Including Hidden Fields on Forms describes the purpose of hidden fields in *.htm files.
Code in viewData.asp instantiates the data access component (SQLXML) and calls a method in this component passing the Request object as a parameter.
The following implementation topics include information on viewData.asp and the role this ASP page plays in the PT application:
Note The ASP page named viewData.asp is the one the PT application implements. This is the version that calls a component, which in turn retrieves the data. Code Listings and Object Reference includes an earlier version of viewData.asp called viewData_Old.asp. This earlier version contains the code that was later moved to the SQLXML component.
PT application form views allow users to add, change, and delete records in the Eval database. The LitWare designers plan to use stored procedures to perform these table actions.The name of the stored procedure is stored in the hidden field procName and passed to postIt.asp in the ASP Request object. Stored Procedures for Table Actions lists the actions the application needs to perform on each Eval database table. Stored Procedures for the PT Application contains a table that lists all the stored procedures the application implements and the JavaScript file that loads the name of each stored procedure into a hidden field on the form. Additional values the stored procedure needs, such as the unique identifier of the record that is the subject of the add, change, or delete, is also stored in a hidden field. Including Hidden Fields on Forms describes the purpose of hidden fields in *.htm files.
Code in postIt.asp instantiates the data access component (SQLXML) and calls a method in this component passing the Request object as a parameter.
Note The ASP page named postIt.asp is the one the PT application implements. This is the version that calls a component, which in turn retrieves the data. Code Listings and Object Reference includes an earlier version of postIt.asp called postIt_Old.asp. This earlier version contains the code that was later moved to the SQLXML component.