📄 financesearch.aspx.cs
字号:
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.Configuration;
namespace Manage.FinanceManage
{
/// <summary>
/// FinanceSearch 的摘要说明。
/// </summary>
public class FinanceSearch : System.Web.UI.Page
{
protected System.Data.SqlClient.SqlDataReader reader;
protected System.Data.SqlClient.SqlConnection conn;
protected System.Data.SqlClient.SqlCommand cmd;
protected string myConn;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected string cmdText;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Search;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.HtmlControls.HtmlTableCell TD1;
protected Manage.DataSet1 dataSet11;
private void Data_Bind()
{
myConn=ConfigurationSettings.AppSettings["mySql"];
cmdText="select * from Student";
this.sqlConnection1=new System.Data.SqlClient.SqlConnection(myConn);
this.sqlConnection1.Open();
this.sqlDataAdapter1=new System.Data.SqlClient.SqlDataAdapter(cmdText,this.sqlConnection1);
this.dataSet11=new DataSet1();
this.sqlDataAdapter1.Fill(this.dataSet11,"Student");
this.DataGrid1.DataSource=this.dataSet11;
this.DataGrid1.DataBind();
this.sqlConnection1.Close();
}
private void Grid_Bind()
{
myConn=ConfigurationSettings.AppSettings["mySql"];
string s;
s=this.DropDownList1.SelectedValue.ToString()+"="+"'"+this.TextBox1.Text+"'";
cmdText="select * from Student where ";
cmdText=cmdText+s;
this.sqlConnection1=new System.Data.SqlClient.SqlConnection(myConn);
this.sqlConnection1.Open();
this.sqlDataAdapter1=new System.Data.SqlClient.SqlDataAdapter(cmdText,this.sqlConnection1);
this.dataSet11=new DataSet1();
this.sqlDataAdapter1.Fill(this.dataSet11,"Student");
this.DataGrid1.DataSource=this.dataSet11;
this.DataGrid1.DataBind();
this.sqlConnection1.Close();
}
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!IsPostBack)
Data_Bind();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Student", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("Student_ID", "Student_ID"),
new System.Data.Common.DataColumnMapping("Student_Name", "Student_Name"),
new System.Data.Common.DataColumnMapping("Student_Password", "Student_Password"),
new System.Data.Common.DataColumnMapping("Student_Birth", "Student_Birth"),
new System.Data.Common.DataColumnMapping("Student_Sex", "Student_Sex"),
new System.Data.Common.DataColumnMapping("Student_Photo", "Student_Photo"),
new System.Data.Common.DataColumnMapping("Student_Depart", "Student_Depart"),
new System.Data.Common.DataColumnMapping("Student_Course", "Student_Course"),
new System.Data.Common.DataColumnMapping("Student_Postion", "Student_Postion"),
new System.Data.Common.DataColumnMapping("Room_ID", "Room_ID"),
new System.Data.Common.DataColumnMapping("Student_Email", "Student_Email"),
new System.Data.Common.DataColumnMapping("Student_LiveCost", "Student_LiveCost"),
new System.Data.Common.DataColumnMapping("Student_StudyCost", "Student_StudyCost"),
new System.Data.Common.DataColumnMapping("Student_Address", "Student_Address"),
new System.Data.Common.DataColumnMapping("Student_Phone", "Student_Phone")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM Student WHERE (Student_ID = @Original_Student_ID) AND (Room_ID = @Original_Room_ID OR @Original_Room_ID IS NULL AND Room_ID IS NULL) AND (Student_Address = @Original_Student_Address OR @Original_Student_Address IS NULL AND Student_Address IS NULL) AND (Student_Birth = @Original_Student_Birth OR @Original_Student_Birth IS NULL AND Student_Birth IS NULL) AND (Student_Course = @Original_Student_Course) AND (Student_Depart = @Original_Student_Depart) AND (Student_Email = @Original_Student_Email OR @Original_Student_Email IS NULL AND Student_Email IS NULL) AND (Student_LiveCost = @Original_Student_LiveCost OR @Original_Student_LiveCost IS NULL AND Student_LiveCost IS NULL) AND (Student_Name = @Original_Student_Name) AND (Student_Password = @Original_Student_Password OR @Original_Student_Password IS NULL AND Student_Password IS NULL) AND (Student_Phone = @Original_Student_Phone OR @Original_Student_Phone IS NULL AND Student_Phone IS NULL) AND (Student_Photo = @Original_Student_Photo OR @Original_Student_Photo IS NULL AND Student_Photo IS NULL) AND (Student_Postion = @Original_Student_Postion OR @Original_Student_Postion IS NULL AND Student_Postion IS NULL) AND (Student_Sex = @Original_Student_Sex) AND (Student_StudyCost = @Original_Student_StudyCost OR @Original_Student_StudyCost IS NULL AND Student_StudyCost IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_ID", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_ID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Room_ID", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Room_ID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Address", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Address", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Birth", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Birth", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Course", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Course", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Depart", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Depart", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Email", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Email", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_LiveCost", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_LiveCost", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Name", System.Data.SqlDbType.VarChar, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Name", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Password", System.Data.SqlDbType.VarChar, 16, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Password", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Phone", System.Data.SqlDbType.VarChar, 12, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Phone", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Photo", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Photo", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Postion", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Postion", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_Sex", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_Sex", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Student_StudyCost", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Student_StudyCost", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=\"BBS-HZ0752-NET\";packet size=4096;integrated security=SSPI;data so" +
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -