private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
int IntRowCount;
SqlConnection cnn = new SqlConnection("server=(local);database=num1;uid=sa;pwd=123456;");
cnn.Open ();
SqlDataAdapter sda = new SqlDataAdapter("select * from a order by ID",cnn);
DataSet myds= new DataSet();
sda.Fill(myds,"aut");
int iRowCount=myds.Tables["aut"].Rows.Count ;
int iCC=myds.Tables ["aut"].Columns.Count ;
DataTable mydt=myds.Tables ["aut"];
DataView myView = new DataView(mydt);
for(int i=0;i<=iRowCount-1;i++)
{
TableRow r =new TableRow ();
TableCell c1=new TableCell ();
Label myLabel1=new Label ();
myLabel1.ID ="Lbl1" & Trim(myView.Table("aut").Rows(i).Item("item1")).ToString();
if (myView.Table("aut").Row(i).Item("item2").GetType.ToString="System.DBNull")
{
myLabel1.Text ="";
}
else {myLabel1.Text=Trim(myView.Table ("aut").Rows(i).Item("item1"));}
c1.Controls .Add (myLabel1);
r.Cells.Add (c1);
Table1.Rows.Add(r);
}
}
请问哪位朋友是否知道,我出错在哪里呀!!!,而我在遍译是出现了System.Data.DataView.Table表示属性,要用方法,
我不知道.