高手进来看看
public string person1 = "";
public string person2 = "";
public string person3 = "";
public string person4 = "";
public string person5 = "";
public string person6 = "";
public string person7 = "";
public string person8 = "";
public string person9 = "";
public string person10 = "";
public string person11 = "";
public string person12 = "";
public string person13 = "";
public string person14 = "";
public string person15 = "";
public string person16 = "";
public string person17 = "";
public string person18 = "";
public string person19 = "";
public string person20 = "";
public string person21 = "";
public string person22 = "";
public string person23 = "";
public string person24 = "";
public string person25 = "";
public string person26 = "";
public string person27 = "";
public string person28 = "";
public string person29 = "";
public string person30 = "";
public string person31 = "";
public string person32 = "";
public string person33 = "";
public string person34= "";
public string time1 = "";
public string time2 = "";
public string time3 = "";
public string time4 = "";
public string time5 = "";
public string time6 = "";
public string time7 = "";
public string time8 = "";
public string time9 = "";
public string time10 = "";
public string time11 = "";
public string time12 = "";
public string time13 = "";
public string time14 = "";
public string time15 = "";
public string time16 = "";
public string time17 = "";
public string state1 = "";
public string state2 = "";
public string state3 = "";
public string state4 = "";
public string state5 = "";
public string state6 = "";
public string state7 = "";
public string state8 = "";
public string state9 = "";
public string state10 = "";
public string state11 = "";
public string state12 = "";
public string state13 = "";
public string state14 = "";
public string state15 = "";
public string state16 = "";
public string state17 = "";
public string state18 = "";
public string state19 = "";
public string state20 = "";
public string state21 = "";
public string state22 = "";
public string state23 = "";
public string state24 = "";
public string state25 = "";
public string state26 = "";
public string state27 = "";
public string state28 = "";
public string state29 = "";
public string state30 = "";
public string state31 = "";
public string state32 = "";
public string state33 = "";
public string state34 = "";
public string aa = "";
process pro = new process();
examine exa = new examine();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
private void BindData()
{
string str = "SELECT count(*) FROM tb_item";
string sql = "SELECT tb_item.* from tb_item ";
item item = new item();
this.AspNetPager1.RecordCount = item.GetCount(str);
DataSet dr = item.GetNewsPage(sql,AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "item");
DataTable da = dr.Tables["item"];
this.rp.DataSource = da;
this.rp.DataBind();
foreach (DataRow dr1 in da.Rows)
{
string cs = dr1["itemID"].ToString();
DataTable Tab1 = pro.GetDable(cs);
if (Tab1.Rows.Count > 0)
{
foreach (DataRow dr2 in Tab1.Rows)
{
if (dr2["processCategoryID"].ToString() == "1")
{
person1 = dr2["process_person"].ToString();
time1 = dr2["process_time"].ToString();
state1 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "2")
{
person2 = dr2["process_person"].ToString();
time2 = dr2["process_time"].ToString();
state2 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "3")
{
person3 = dr2["process_person"].ToString();
time3 = dr2["process_time"].ToString();
state3 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "4")
{
person4 = dr2["process_person"].ToString();
time4 = dr2["process_time"].ToString();
state4 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "5")
{
person5 = dr2["process_person"].ToString();
time5 = dr2["process_time"].ToString();
state5 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "6")
{
person6 = dr2["process_person"].ToString();
time6 = dr2["process_time"].ToString();
state6 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "7")
{
person7 = dr2["process_person"].ToString();
time7 = dr2["process_time"].ToString();
state7 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "8")
{
person8 = dr2["process_person"].ToString();
time8 = dr2["process_time"].ToString();
state8 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "9")
{
person9 = dr2["process_person"].ToString();
time8 = dr2["process_time"].ToString();
state8 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "10")
{
person10 = dr2["process_person"].ToString();
time10 = dr2["process_time"].ToString();
state10 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "11")
{
person11 = dr2["process_person"].ToString();
time11 = dr2["process_time"].ToString();
state11 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "12")
{
person12 = dr2["process_person"].ToString();
time12 = dr2["process_time"].ToString();
state12 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "13")
{
person13 = dr2["process_person"].ToString();
time13 = dr2["process_time"].ToString();
state13 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "14")
{
person14 = dr2["process_person"].ToString();
time14 = dr2["process_time"].ToString();
state14 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "15")
{
person15 = dr2["process_person"].ToString();
time15 = dr2["process_time"].ToString();
state15 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "16")
{
person16 = dr2["process_person"].ToString();
time16 = dr2["process_time"].ToString();
state16 = dr2["process_state"].ToString();
}
else if (dr2["processCategoryID"].ToString() == "17")
{
person17 = dr2["process_person"].ToString();
time17 = dr2["process_time"].ToString();
state17 = dr2["process_state"].ToString();
}
else
{
}
}
}
else
{
}
}
}
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
BindData();
}
前台<%= person1%> 这些信息都是最后一条数据 如何修改代码啊,如何一条数据一分页那就对啦
[解决办法]
用数组代替,应该不会错吧