?? query.aspx.cs
字號(hào):
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace WebApplication2
{
/// <summary>
/// Query 的摘要說明。
/// </summary>
public class Query : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblAccount;
protected System.Web.UI.WebControls.Label lblUserName;
protected System.Web.UI.WebControls.Label lblMoneyCount;
protected System.Web.UI.WebControls.LinkButton LinkButton1;
protected System.Web.UI.WebControls.Panel Panel1;
public string account;
private void Page_Load(object sender, System.EventArgs e)
{
account=Request.QueryString["Account"];
this.lblAccount.Text=account;
// 打開數(shù)據(jù)庫連接
SqlConnection con=DB.createCon();
con.Open();
// 創(chuàng)建命令對(duì)象
SqlCommand cmd=new SqlCommand("select * from bank where account='"+account+"'",con);
// 創(chuàng)建只讀的數(shù)據(jù)流
SqlDataReader myDataReader=cmd.ExecuteReader();
while(myDataReader.Read())
{
this.lblUserName.Text=myDataReader.GetString(1);
this.lblMoneyCount.Text="人民幣:"+myDataReader.GetInt64(2)+" 元";
}
// 關(guān)閉對(duì)象
myDataReader.Close();
con.Close();
}
#region Web 窗體設(shè)計(jì)器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設(shè)計(jì)器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.LinkButton1.Click += new System.EventHandler(this.LinkButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void LinkButton1_Click(object sender, System.EventArgs e)// 返回
{
Response.Redirect("Login.aspx?Account="+account);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -