创建本文及后面几篇文章要用到的页面。新 建一个名为AdvancedDAL的文件夹,然后添加如下的ASP.NET页面,记得使用母版 页Site.master:
Default.aspx
NewSprocs.aspx
ExistingSprocs.aspx
< p>JOINs.aspx
AddingColumns.aspx
ComputedColumns.aspx
EncryptingConfigSections.aspx
ManagedFunctionsAndSprocs.aspx
图1:添加相关的页面
像其它文件夹一样,Default.aspx页面将 列出本部分的内容,记得SectionLevelTutorialListing.ascx用户控件提供了该 功能。因此,将其从解决资源管理器里拖放到Default.aspx页面.
图2:将SectionLevelTutorialListing.ascx用户控件拖到 Default.aspx页面
最后,将这些页面添加到Web.sitemap文件里。特别的 ,把下面的代码放在“Working with Batched Data”
<siteMapNode>标签后面:
<siteMapNode url="~/AdvancedDAL/Default.aspx"
title="Advanced DAL Scenarios"
description="Explore a number of advanced Data Access Layer scenarios.">
<siteMapNode url="~/AdvancedDAL/NewSprocs.aspx"
title="Creating New Stored Procedures for TableAdapters"
description="Learn how to have the TableAdapter wizard automatically
create and use stored procedures." />
<siteMapNode url="~/AdvancedDAL/ExistingSprocs.aspx"
title="Using Existing Stored Procedures for TableAdapters"
description="See how to plug existing stored procedures into a
TableAdapter." />
<siteMapNode url="~/AdvancedDAL/JOINs.aspx"
title="Returning Data Using JOINs"
description="Learn how to augment your DataTables to work with data
returned from multiple tables via a JOIN query." />
<siteMapNode url="~/AdvancedDAL/AddingColumns.aspx"
title="Adding DataColumns to a DataTable"
description="Master adding new columns to an existing DataTable." />
<siteMapNode url="~/AdvancedDAL/ComputedColumns.aspx"
title="Working with Computed Columns"
description="Explore how to work with computed columns when using
Typed DataSets." />
<siteMapNode url="~/AdvancedDAL/EncryptingConfigSections.aspx"
title="Protected Connection Strings in Web.config"
description="Protect your connection string information in
Web.config using encryption." />
<siteMapNode url="~/AdvancedDAL/ManagedFunctionsAndSprocs.aspx"
title="Creating Managed SQL Functions and Stored Procedures"
description="See how to create SQL functions and stored procedures
using managed code." />
</siteMapNode>
更新 Web.sitemap文件后,花点时间在浏览器里查看,左边的菜单将包括本部分的内容 .
图3:网站地图现在包含了不部分的页面
第二步:设置 TableAdapter创建新的存储过程
我们在~/App_Code/DAL文件夹里创建一个 类型化的DataSet,名称为NorthwindWithSprocs.xsd.由于 |