Archive for August, 2007

Chapter 12 Using (Web hosting plans) Data in Web Pages In

Friday, August 31st, 2007

Chapter 12 Using Data in Web Pages In This Chapter Binding data to pages Using the Data Source Configuration Wizard Using the GridView and DetailsView controls Using the DataList and FormView controls Visual Web Developer is a tool for building dynamic, data-driven Web sites dynamic because the information you display on these Web pages doesn t have to be the same for everyone. You can get your site to create a page that s appropriate for every user, showing only the appropriate (user-specific) data from a database. Take a big search engine like Google for instance. When you submit a search string to Google, you re actually submitting a query to its database. What its database spits back are pages and pages of links to Web pages that contain the word or phrase you searched for. In other words, Google s Web site dynamically created the page you see using data from its database. To display data from your site s database in Web pages, you bind data from the database to controls on the page. While sitting on your server, the control is just a placeholder that contains no data. When a Web site visitor requests the page, the control can then be filled with whatever data is appropriate to that specific request. In other words, if 100 different people visit the page, each might see something different, just as 100 different people doing different Google searches see 100 different lists of things in the page that Google sends them. What makes the page dynamic is that the page contains only data that is relevant to the user s request and that changes from user to user. This chapter explores how to use dynamic content in your own Web pages: how to bind the data to controls and how to place that data into your Web site.
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

260 Part III: Personalization (Cpanel web hosting) and Databases

Thursday, August 30th, 2007

260 Part III: Personalization and Databases
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

Photoshop web design - To add data to the table, right-click its

Thursday, August 30th, 2007

To add data to the table, right-click its name in Database Explorer and choose Show Table Data. When typing in data, remember to leave the SiteId field set to Null, as it will be numbered automatically after you ve filled the other fields. You can type any text for the site s name or title. But when specifying the site s URL, make sure you use the full http://… address. Figure 11-39 shows an example where I ve put in some site titles and the links to those sites. The links don t actually do anything in the table. Remember, the table is just a means of storing the data. But as you ll discover in Chapter 12, you can use a DataList control to create a page that displays each site title as a link that takes the user directly to the site. Thus ends the world s quickest SQL Server/Database Design crash course. There is a great deal more to know about those topics. (But you knew that.) What you ve discovered here should be enough to get you started. If nothing else, it has covered a lot of things many other VWD information resources will assume you already know. Chapter 12 shows many ways of putting the data to good use within the site. Figure 11-39: Storing links in a table. Chapter 11: SQL Server Crash Course 259
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

4. Clear the check box for Allow Nulls. (Web host forum)

Wednesday, August 29th, 2007

4. Clear the check box for Allow Nulls. 5. In the Column Properties pane, click + next to Identity Specification. 6. Set the (Is Identity) property to Yes. You can leave the Identity Increment and Identity Seed fields each set to one. 7. Right-click the SiteId field name and choose Set Primary Key. Figure 11-37 shows the table structure so far, with just the auto-numbered primary key SiteId defined. 8. Add a second field to store the site s title. For my example, I ll name that field SiteName and set its Data Type to nvarchar(50). 9. Add a third field for storing the site s URL. In my example, I ll name it SiteURL and give it the varchar Data Type with a maximum length of 64 characters. Figure 11-38 shows my completed table structure. 10. Click Close in the upper-right corner of the Design surface. 11. When asked about saving the table, choose Yes. 12. Name the table Links and click OK. Figure 11-38: Structure of my sample Links table. Figure 11-37: The primary key for a table of hyperlinks. 258 Part III: Personalization and Databases
Check Tomcat Web Hosting services for best quality webspace to host your web application.

The table doesn t look like much with just (Web host)

Tuesday, August 28th, 2007

The table doesn t look like much with just the text in it. However, keep in mind that a table is always just raw data and how things look in the table doesn t dictate how they ll look on a page. As you ll discover in Chapter 12, you can use a DataList control with the Photos table to show the actual pictures and captions on a page. For now it s sufficient to just close and save the table. Creating a Table of HyperLinks If your site has many links to Web sites outside your own site, you can store all those links in a database table. Doing so keeps all the links in one place, where they re easy to manage. You can then use whatever links you want on any page you want without having to worry about keeping links up-to-date across many different pages within your site. For a table of links, you ll need at least two text fields, one for the name or title of the site, and one for the site s URL (address). If you like, you could add a third field for storing a description of each site. Also, if you want to be able to edit the table s data through Web pages, the table will need a primary key. To keep things fairly simple, I ll show you how to create a table that contains a primary key, a field for storing each site s name, and a field for storing each site s address. The steps are: 1. If you re in Solution Explorer, click the Database Explorer tab. 2. Right-click on Tables under the database name and choose Add New Table. 3. Type SiteId as the first field name, and set its Data Type to smallint. If you think you ll have more than 32,000 links, use the int data type rather than smallint. Figure 11-36: Some sample records in my Photos table. Chapter 11: SQL Server Crash Course 257
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.

Remote web server - 8. Add a second field named PhotoCaption, and

Monday, August 27th, 2007

8. Add a second field named PhotoCaption, and set its Data Type to varchar( 50). 9. Add a third field named PhotoURL and set its Data Type to varchar( 64). Figure 11-35 shows the final structure of the table. When defining a field that stores any kind of URL or address, use either varchar or nvarchar. Using char or nchar will pad short addresses with blank spaces, which in turn may prevent the link from working properly later when used on a page. 10. Click the Close (X) button in the upper-right corner of the Design surface. 11. Choose Yes when asked about saving your changes. 12. Change the name of the table to Photos, then click OK. Now you have a new table, named Photos, in the database. Each record in the table can contain a photo caption and the link to a photo. If you already have your pictures in a folder, you can right-click the table and choose Show Table Data. Because PhotoID is an automatically-numbered field, you want to leave it as Null when entering new records. Just type a caption name and a link to a picture in the PhotoCaption and PhotoURL fields. Then type a caption and link for each photo. For my example, where each photo is a picture of a flower, I put a (fake) Latin name for each photo into the PhotoCaption field, and a link to each photo in the PhotoURL field. (I don t know the actual Latin names for the flowers, so I just made some up, borrowing a few names from animal anatomy.) Figure 11-36 shows an example. I ve opened Solution Explorer in that figure so you can see how the PhotoURL in each record refers to a specific image in the ~/Images/FlowerPix folder. Figure 11-35: Completed Photos table design. 256 Part III: Personalization and Databases
We recommend high quality webhost to host and run your jsp application: christian web host services.

Next, you can create a table that contains (My web server)

Sunday, August 26th, 2007

Next, you can create a table that contains three fields. One field will be a primary key that just assigns each record a unique number. Even though this table won t be on the one side of a one-to-many relationship, a table needs to have a primary key if you want to be able to edit it through Web pages. So we ll add a primary key to the table we re about to create. The second field will be a caption or title for each photo. The third field will be the path and filename of a photo. The path to each picture will look something like this: ~/Images/FlowerPix/Flowerxx.jpg where ~/Images/FlowerPix means the FlowerPix folder in the Images folder, under the root (~) folder. The Flowerxx.jpg will be the name of a specific picture within that folder. I ll name the sample table Photos. You create it as you would any other table. Here are the steps: 1. If you re in Solution Explorer, click the Database Explorer tab. 2. Right-click on Tables under the database name and choose Add New Table. ` 3. Type PhotoId as the first field name, and make it the smallint data type. If you think you ll have more than 32,000 pictures, use the int data type rather than smallint. 4. Clear the check mark from the Allow Nulls field. 5. In the Column Properties, click the + sign next to Identity Specification. 6. Set the (Is Identity) property to Yes. You can leave the Identity Increment and Identity Seed each set to 1, so records are just numbered 1, 2, 3, 4, and so forth. 7. Right-click the PhotoId field name and choose Set Primary key. Figure 11-34 shows how the table design should look so far. Figure 11-34: The PhotoId field is an autonumbered primary key. Chapter 11: SQL Server Crash Course 255
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

In real life, there would rarely be any (Web hosting)

Saturday, August 25th, 2007

In real life, there would rarely be any need to open a view from Database Explorer and see the records it returns, because the way the results are shown in Database Explorer aren t especially pretty or easy to read. Instead normally you d use the view to extract data from your tables via databound controls in the Web pages you create. Each data-bound control can choose as much (or as little) information from the view as it needs. For example, one control could display a list of all users who purchased a specific item. Another could list all items purchased by a specific user. Still other controls could organize information from the view in other ways. Creating a Table of Pictures Not all database tables need to be linked to other tables. You can use a database table to store things that don t relate directly to specific users or specific items. For example, if you have pictures you want to show or allow people to download, you can create a table of pictures. Then, as you ll see in Chapter 12, you can use Data controls to make it easy to display multiple pictures on a page. You don t need to put the pictures directly in the database. Rather, you can store all the pictures in a folder (or multiple folders). Then just create a table that identifies the picture s location within your site. As an example, Figure 11-33 shows where I ve created a subfolder named FlowerPix within my Images folder in Solution explorer. Each of the filenames, Flower02,jpg, Flower02.jpg, and so forth, is a photo of a flower. Figure 11-33: The FlowerPix folder contains ten pictures of flowers. 254 Part III: Personalization and Databases
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

results. However, this view offers more information about (Domain and web hosting)

Friday, August 24th, 2007

results. However, this view offers more information about who made each purchase including each user s e-mail address, the date he or she created the account, the date of the user s last login, and more. Figure 11-31 shows the results but actually the results table is wide enough to see all the columns. Suffice it to say that for every checked field name in Figure 11-30, there s a field containing data in the query results. For purposes of future examples, I saved the query shown in Figure 11-30 as DetailedUsersItemsView, so in my own Database Explorer, that name has been added to the list of Views in the current database (as in Figure 11-32). To execute a view to see only the data it retrieves without seeing its design you can right-click the view name and choose Show Results. The way the data looks in the view results is of zero importance. Formatting takes place when you display data from a view in a Web page. Figure 11-32: Two new Views added to the database. Figure 11-31: Results of executing the detailed query. Chapter 11: SQL Server Crash Course 253
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

There is, however, a view named vw_aspnet_MembershipUsers already (Medical web site)

Thursday, August 23rd, 2007

There is, however, a view named vw_aspnet_MembershipUsers already defined under Views in Database Explorer. You can use that view in place of the aspnet_Users table to create a query that includes users e-mail addresses. Creating another view named DetailedUsersItemsView illustrates the point: 1. Right-click the Views folder and choose Add New View. 2. In the Add Tables dialog box, click the Views tab, click vw_aspnet_MemberhsipUsers, then click the Add button. 3. In the Add Tables dialog box, click the Tables tab. 4. Click the Transactions table, then click Add. 5. Click the Items table, then click Add. 6. Click Close in the Add Tables dialog box. 7. In the diagram pane, drag the UserId field in the vw_aspnet_ MembershipUsers field list to the UserId field name in the Transactions table. The two fields will then be connected by a line as shown in Figure 11-30. In Figure 11-30, I sized and arranged things so you can see all the field lists and the lines joining the tables by their key fields. The query can return any fields from any table you see. In Figure 11-30, I chose some fields that might come in handy in the future. However, you can choose any fields you like. Executing the query returns a set of records similar to those from the lessdetailed query exactly one record per transaction shows up in the query Figure 11-30: The Detailed Users Items View s tables and selected fields. 252 Part III: Personalization and Databases
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.