分类:
2006-02-16 16:08:38
打印機維修反饋系統 |
后台:
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 printer
{
///
/// price_user 的摘要说明。
///
public class price_user : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lbrequest_id;
protected System.Web.UI.WebControls.Table tbl;
protected System.Web.UI.WebControls.Table Table1;
protected System.Web.UI.WebControls.Label lb_comid;
protected System.Web.UI.WebControls.Repeater re_price;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
string request_id = Request.QueryString.Get("request_id");
this.lbrequest_id.Text= request_id;
SqlConnection myConn = new SqlConnection("server=intranet;database=intranet;user id=sa;pwd=syd8gmt");
string selCmd = "select * from (select price_name,comprice_sum,price_price,price_price * comprice_sum AS comprice_total FROM printer_comprice,printer_price where printer_price.price_id = printer_comprice.price_id and request_id='"+request_id+"') as e";
string totalCmd ="select sum(c.total) as total from(select a.comprice_sum,b.price_price,a.comprice_sum*b.price_price as total from printer_comprice as a,printer_price as b where b.price_id=a.price_id and request_id='"+request_id+"') as c ";
SqlDataAdapter da = new SqlDataAdapter(selCmd,myConn);
SqlDataAdapter da1 = new SqlDataAdapter(totalCmd,myConn);
DataSet ds = new DataSet();
da.Fill(ds,"e");
da1.Fill(ds,"c");
this.re_price.DataSource=ds.Tables["c"].DefaultView;
this.re_price.DataBind();
int countx = ds.Tables["e"].Rows.Count;
int county = ds.Tables["e"].Columns.Count;
for( int x=countx-1;x>=0;x--)
{
TableRow trcontent = new TableRow();
TableCell tc = new TableCell();
int id = x+1;
tc.Text = id.ToString();
trcontent.Cells.Add(tc);
for(int y = 0;y
TableCell tccontent = new TableCell();
tccontent.Text=ds.Tables["e"].Rows[x][y].ToString();
trcontent.Cells.Add(tccontent);
}
this.tbl.Rows.AddAt(1,trcontent);
}
}
}
}