- 博客(0)
- 资源 (1)
空空如也
完整宿舍管理系统设计与开发
public partial class 查询收费 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("查宿舍缴费.aspx");
}
protected void Button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection();
string strconn;
strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\考试项目\\App_Data\\宿舍管理信息系统.mdb";
conn.ConnectionString = strconn;
conn.Open();
string sql, textDormID, textMDate, textEBuy, textCPerson, textCMoney;
textDormID = TextBox1.Text.Trim() + "%";
textMDate = TextBox5.Text.Trim() + "%";
textEBuy = TextBox3.Text.Trim() + "%";
textCPerson = TextBox2.Text.Trim() + "%";
textCMoney = TextBox4.Text.Trim() + "%";
sql = "select ChargeID as 收费编号,dormID as 宿舍号,MDate as 收费日期,EBuy as 购买电量,CPerson as 缴费人,CMoney as 电费 from charge " +
"where dormID like'" + textDormID +
"'and MDate like '" + textMDate +
"'and EBuy like '" + textEBuy +
"'and CPerson like '" + textCPerson +
"'and CMoney like '" + textCMoney + "'";
OleDbDataAdapter adp = new OleDbDataAdapter(sql, conn);
DataSet ds = new DataSet();
adp.Fill(ds, "charge");
if (ds.Tables["charge"].Rows.Count > 0)
{
Label2.Text = "共有" + ds.Tables["charge"].Rows.Count + "条记录!";
GridView1.DataSource = ds.Tables["charge"].DefaultView;
GridView1.DataBind();
}
else
{
Label2.Text = "共有0条记录!";
GridView1.DataBind();
}
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
}
}
2010-04-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人