?? redetailsmodule.ascx.cs
字號:
namespace KhfwWeb.Modules
{
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// ReDetailsModule 的摘要說明。
/// </summary>
public class ReDetailsModule :ModuleBase
{
protected System.Web.UI.WebControls.Label RecordIdLabel;
protected System.Web.UI.WebControls.Label NowTimeLabel;
protected System.Web.UI.WebControls.DropDownList LevelList;
protected System.Web.UI.WebControls.TextBox RDetailsTextBox;
protected System.Web.UI.WebControls.DropDownList StatusList;
protected System.Web.UI.WebControls.RadioButtonList ResearchList;
protected System.Web.UI.WebControls.Label ClientNameLabel;
protected System.Web.UI.WebControls.Label CNameLabel;
protected System.Web.UI.WebControls.Label PhoneLabel;
protected System.Web.UI.WebControls.Label LogPersonLabel;
protected System.Web.UI.WebControls.Label FinishDateLabel;
protected System.Web.UI.WebControls.Label RemarksLabel;
protected System.Web.UI.WebControls.LinkButton Shutdown;
protected System.Web.UI.WebControls.Label ShowMsg;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
//顯示記錄序號信息
RecordIdLabel.Text=Request.QueryString ["RecordId"].ToString ();
//從文件Web.config中讀取連接字符串
string sqldb= ConfigurationSettings.AppSettings["ConnectionString"];
//連接JdglSys數據庫
SqlConnection Conn = new SqlConnection (sqldb);
Conn.Open ();
//利用Command對象調用存儲過程
SqlCommand mycommand=new SqlCommand("sp_GetRecordById",Conn);
//將命令類型轉為存儲類型
mycommand.CommandType =CommandType.StoredProcedure ;
mycommand.Parameters .Add ("@RecordId",SqlDbType.Int);
mycommand.Parameters ["@RecordID"].Value = int.Parse(RecordIdLabel.Text);
SqlDataReader dr=mycommand.ExecuteReader ();
if(dr.Read ())
{
ClientNameLabel.Text=dr["ClientName"].ToString();
CNameLabel.Text=dr["CPerson"].ToString();
PhoneLabel.Text=dr["CTel"].ToString();
LevelList.SelectedIndex=int.Parse(dr["RLevel"].ToString());
RDetailsTextBox.Text=dr["RDetails"].ToString();
StatusList.SelectedIndex=int.Parse(dr["RStatus"].ToString());
LogPersonLabel.Text=dr["LogPerson"].ToString();
NowTimeLabel.Text=dr["CreateDate"].ToString();
if(StatusList.SelectedIndex==3)
FinishDateLabel.Text=dr["FinishDate"].ToString();
else
FinishDateLabel.Text="";
RemarksLabel.Text =dr["Remarks"].ToString();
ResearchList.SelectedIndex=int.Parse(dr["IsResearch"].ToString());
}
//關閉Conn
Conn.Close();
}
}
#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
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -