请看看我的错误?
各位,问题小遇,具体的如下,private num=3;//在上面定义的私有变量,为了换行
i=0;//记数器
TableRow tr1=new TableRow();
OleDbConnection con=DBConn.Createconn();
con.open();
OleDbCommand cmd=new OleDbCommand("SQL语句",con);
OleDbDataReader odr=cmd.executereader();
TableRow tr1=new TableRow();
while(odr.read())
{
i=i+1;
TableCell tc=new TableCell();
mygood mg=(mygood)this.loadcontrol("自定义控件");
mg.product=odr["productId"].tostring();
tc.controls.add(mg);
tr1.controls.add(tc);
if((i%this.num)==0)
{
this.table2.rows.add(tr1);
TableRow tr1=new TableRow;//提示这里不让重定义,说是已经有用了,但是为了生成新行,只能这样的用
}
}
if((i%this.num)!=0)
{
this.table2.rows.add(tr1);
}
高手,请回答我一下吗?我真的解决不了.



