WindowsDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


AddThis Social Bookmark Button

Creating an Application from Scratch, Part 2
Pages: 1, 2, 3, 4

Running the Program

To run this program I need my CustomerID. This is easily obtained by going to any book I've reviewed and clicking on my name. This brings me to my profile page, and in the URL is my CustomerID as shown in Figure 5.

Figure 5
Figure 5. Your Amazon CustomerID appears in the URL of your Profile page.

With my CustomerID in hand, I can fire up my sketchy test page and to get all my reviews into the database, as shown in Figure 6.

Figure 6
Figure 6. Our ugly little test page--it works.

As you can see, this is an ugly little test page that takes a CustomerID (in this case mine) and fires off the code shown above. It then reports on which records were inserted into the database (the first set of numbers is the ISBN, the second is the user's ID) and also reports on any rejected attempts. For example, the ISBN 0596003218 was rejected because of the Primary Key constraint. This is appropriate, because it turns out I have two reviews of that book, and the database is designed to ensure only one review per book per user.

Because reading the rejected records is important, I've implemented event handling for selecting a listing in the bottom listbox, and I turn on AutoPostback programmatically after all the records have been added. The implementation for the SelectedIndexChanged method is incredibly simple, it just writes the entire selected text to lblMessage, as shown in Figure 7.

Figure 7
Figure 7. Simple event handling for rejected records

Pages: 1, 2, 3, 4

Next Pagearrow