Creating Dynamic Web Pages


To create Web pages that display (and perhaps allow the user to update) data from a database, you must create a special type of Web page containing script that can fetch and update the data. The most common way to do this is to create an Active Server Page (ASP) that runs on the Web server to fetch requested information from a database, format it as HTML, and send it to the client browser. An alternate method is to use HTML forms that contain an ActiveX control and script to perform the same tasks. When you create an HTML form, you can design it to run the database code on the server or on the client.

With Microsoft’s introduction of the .NET architecture and ASP.NET, creating dynamic Web pages is almost as easy as creating desktop database applications. These tools help you create ASPs or HTML forms to handle the database processing. You can also use Expression Web to build HTML forms that deliver dynamic information from your database. Let’s take a brief look at these technologies.

Delivering Dynamic Query Results

If, whenever a Web visitor requests a page, you want your Web page to query the database and return the result to the visitor, you must create a dynamic Web page. Figure 21–22 shows the most common network architecture you can build using Access as the database file server to report up-to-the-minute, live database contents. The browser requests a special kind of Web page-an ASP-that contains a mixture of HTML and script code. The script code, running on the server and working through several layers of software, opens the database, runs the query, and formats the results. The Web server then transmits the results to the Web visitor’s browser as pure HTML.

Note 

The script code generated by Microsoft products in ASPs is Microsoft Visual Basic Scripting Edition (VBScript).

image from book
Figure 21–22: A high-level schematic shows the delivery of database queries dynamically.

Inside Out-Installing Microsoft Internet Information Services and IN Expression Web 

Any ASP that you create with Microsoft products is designed to work on Microsoft Internet Information Services (IIS). You can install IIS on Windows 2000 Server, Windows XP Professional, Windows Vista, or Windows Server 2003. If you have Windows Vista on your desktop computer, you can install a local IIS server to test your work. If you didn’t choose to install IIS when you installed Windows Vista, you can add it later by starting the Programs And Features application in Windows Control Panel and then clicking the Turn Windows Features On Or Off link.

If you plan to use Expression Web, you must also install the Microsoft .NET Framework 2.0.

Figure 21–22 shows the following additional components. Even if you never work with these directly, it’s good to know what they are so that you can decipher documentation and error messages.

  • ActiveX objects are prewritten software modules that provide commonly used functions. Most VBScript code in ASPs works by loading and controlling ActiveX objects that run on the Web server. The ActiveX objects you need to build most ASPs are included with the Microsoft Office system and in the Expression Design add-on for the Expression Web product.

  • ActiveX Data Objects (ADO) are collections of ActiveX objects specifically designed to process databases. As you learned in Chapter 19, “Understanding Visual Basic Fundamentals,” the ADO libraries are a standard part of Access.

  • Open Database Connectivity (ODBC) provides a standard interface to many different types of database systems. You configure ODBC through Windows Control Panel. See Chapter 6, “Importing and Linking Data,” for details about managing ODBC connections.

  • The database management system (DBMS) organizes data into databases, tables, and fields. It also accepts commands (usually coded in SQL) that update or query the database. Access 2007 and Microsoft SQL Server are typical DBMSs you can use to support ASPs.

Processing Live Data with HTML Forms

Among the many objects Web pages can contain are various form elements: text boxes, drop-down lists (similar to combo boxes in Access forms), check boxes, option buttons, push buttons (similar to command buttons in Access forms), and ActiveX controls. Web visitors can use these to enter data and submit it to an ASP or other server-based program for processing. Typical database processing includes running customized queries and adding, changing, or deleting records in tables. Processing follows the schematic previously shown in Figure 21–22, except that the server receives form field data from the Web page and the ASP programming is more complex.

HTML forms can’t provide nearly as rich or as helpful an interface as Access forms, but using HTML forms means authorized users anywhere can run your Web application without loading any additional software and regardless of the type of computer the user has. These are important considerations when you need to support many users, many environments, or both.

Using Visual Studio .NET and ASP.NET

Microsoft’s latest answer to software development, Visual Studio .NET, is an editor and project manager that lets you create both Windows desktop applications using one of several languages and Web applications using ASP.NET. .NET allows you to create applications using the programming language of your choice, including Visual Basic .NET, Visual C++ .NET, Visual C# .NET, or Visual J# .NET. No matter which programming language you choose, the compiled version of your program shares the same runtime library with all other languages. When you build a Web application, ASP.NET lets you use any of the available programming languages to generate HTML forms and ASP pages to implement your application.

Visual Studio uses essentially the same user interface as the Visual Basic editor supplied with Access 2007. In addition, Visual Studio provides a WYSIWYG HTML editor, ActiveX controls that generate HTML whenever you save a page that contains them, an assortment of database wizards and design tools, and an interactive debugger for both ASP.NET and scripts that run on the browser. ASP.NET also lets you choose the language that you want to use behind your Web forms, including Visual Basic. Yet, despite all these aids, Visual Studio remains at heart a programmer’s environment. If you’re not comfortable working directly with HTML code, Visual Basic programming, and ActiveX interfaces, this probably isn’t the program for you. Otherwise, rest assured that anything you can do in code, you can do in Visual Studio .NET.

For more information about Expression Web, consult Microsoft Expression Web Designer Inside Out from Microsoft Press.




Microsoft Office Access 2007 Inside Out
MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
ISBN: 0735623252
EAN: 2147483647
Year: 2007
Pages: 234

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net