⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productdetails.aspx.cs

📁 《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含的源代码.非常经典的一本asp.net2.0的书籍
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class ProductDetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		sqldsNorthWind.ConnectionString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;

		sqldsNorthWind.SelectCommand = "select * from Products where ProductName=@ProductName and CategoryID=@CategoryID and SupplierID=@SupplierID";

		//创建QueryStringParam参数
		QueryStringParameter paramProduct = new QueryStringParameter("ProductName", TypeCode.String, "ProductName");
		paramProduct.Direction = ParameterDirection.Input;	//设置参数方向为Input
		sqldsNorthWind.SelectParameters.Add(paramProduct);

		QueryStringParameter paramCategory = new QueryStringParameter("CategoryID", TypeCode.String, "CategoryID");
		paramCategory.Direction = ParameterDirection.Input;
		sqldsNorthWind.SelectParameters.Add(paramCategory);

		QueryStringParameter paramSupplierID = new QueryStringParameter("SupplierID", TypeCode.String, "SupplierID");
		paramSupplierID.Direction = ParameterDirection.Input;
		sqldsNorthWind.SelectParameters.Add(paramSupplierID);

		//指定DetailsView的数据源控件为SqlDataSource控件的ID
		dviewProduct.DataSourceID = sqldsNorthWind.ID;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -