08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

114<br />

CHAPTER 5 ■ <strong>ASP</strong>.<strong>NET</strong> WEB SERVICES<br />

Figure 5-6. Configuring your database connection<br />

You can choose a configuration that is preconnected from either a known database<br />

or an existing <strong>Web</strong>.config setting (as shown in Figure 5-5). If you don’t have an existing<br />

connection, you can create one by clicking the New Connection button. If you want to<br />

look at the steps involved in doing this, refer to Chapters 3 <strong>and</strong> 4.<br />

Once you have selected your connection, click Next. This will take you to the comm<strong>and</strong><br />

type configuration page (see Figure 5-7).<br />

You can choose from three options on this page. The first is to use SQL statements<br />

embedded in your code (dynamic SQL), which can be used to select, insert, update, or<br />

delete data from the database. The second option enables you to create a stored procedure,<br />

which is precompiled code that resides on the database <strong>and</strong> therefore provides<br />

performance, security, <strong>and</strong> code maintenance benefits. Finally, if you have existing stored<br />

procedures in your database, you can use them by selecting the third option.<br />

For this example, pick the first option—because we will be using a parameterized<br />

SQL query <strong>and</strong> there is no existing stored procedure—<strong>and</strong> then click Next.<br />

The next page enables you to type or build the SQL that you’ll use to access the database.<br />

You can see this in Figure 5-8.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!