各位大哥好,我的程序原来用的是datagird自带分页的那种,现在数据多了1000左右,发现速度很慢,无奈之下用了aspnetpager控件,可是我不知道怎么样才能实现多表绑定,希望各位能给我一个列子,非常感谢,或告诉我怎么样把下的数据用aspnetpager的方法实现,非常感谢,我实在是没有办法了,弄了二天都没有搞定
#region 数据绑定1
private  databind(string sqlstr)
{
DBConn myDB = new DBConn();
DataSet rDs=null;
int count=0;
DataSet ds=new DataSet();
try
{
ds=myDB.getDataSet(sqlstr);
int a=ds.Tables[0].Rows.Count;
if(ds.Tables[0].Rows.Count > 0 )
{//if开始
foreach(DataRow row in ds.Tables[0].Rows )
{
count++;
string ID="";
string GID="";
string Name1="";
string Sex1="";
string Branch1="";
ID=row["ID"].ToString ().Trim ();
jh=row["jh"].ToString ().Trim ();
GID=row["GID"].ToString ().Trim ();
Name1=row["Name1"].ToString ().Trim ();
Sex1=row["Sex1"].ToString ().Trim ();
Branch1=row["Branch1"].ToString ().Trim ();
Branch1=databind3(Branch1); //取部门数据
if (count==1)
{
rDs=new DataSet();
System.Data.DataTable myTable=new DataTable();
myTable.TableName="pm_product";
myTable.Columns.Add("ID",System.Type.GetType("System.String"));
myTable.Columns.Add("Name1",System.Type.GetType("System.String"));
myTable.Columns.Add("Sex1",System.Type.GetType("System.String"));
myTable.Columns.Add("Branch1",System.Type.GetType("System.String")););
rDs.Tables.Add(myTable);
}
DataRow myRow=rDs.Tables[0].NewRow();
myRow["ID"]=ID;
myRow["Name1"]=Name1;
myRow["Sex1"]=Sex1;
myRow["Branch1"]=Branch1;
rDs.Tables[0].Rows.Add(myRow);
}
}
ds.Dispose();
}
catch (Exception ex)
{
myDB.Alert (ex.ToString (),Page);
rDs=null;
}
myDB.Close ();
return rDs;
}
#endregion
#region 部门绑定数据
private string databind3(string ID)
{
string str="";
DBConn myDB = new DBConn();
try
{
string sqlstr="select PowerName from Depart where id="+ID;
OleDbDataReader mydr  = myDB.getDataReader( sqlstr );
if( mydr.Read() )
{
str = mydr["PowerName"].ToString();
}
mydr.Close();
myDB.Close();
}
catch (Exception ex)
{
myDB.Alert (ex.ToString (),Page);
return str;
}
return str;
}
#endregion