//cmd.CommandText="select cover from books where bookguid='350bc228-a12d-4c15-b8e0-1e625e40403e'"; SqlDataAdapter da=new SqlDataAdapter(); da.SelectCommand=cmd; DataSet ds=new DataSet(); da.Fill(ds); cn.Close(); this.Label1.Text=ds.Tables[0].Rows[0][1].ToString(); this.Label2.Text=ds.Tables[0].Rows[0][2].ToString(); this.Label4.Text=ds.Tables[0].Rows[0][3].ToString(); this.Panel2.Controls.Add(new LiteralControl(ds.Tables[0].Rows[0][4].ToString())); } } }
#region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load);
} #endregion } }
//购物车页面。实现此功能主要使用DataGrid来显示总计功能。
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CartTest.WebForm1" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="javascript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script> //此JS主要是防止用户输入非数字 function checkNum() { var chr=String.fromCharCode(event.keyCode);
上一篇:ASP.NET应用程序设计的十大技巧
下一篇:ASP.NET 常见问题
|