请各位高手帮我看下这个程序,我搞了半个晚上运行是出错啊
DataTable dt = new DataTable();
dt.Columns.Add( "pictureID ", typeof(int));
dt.Columns.Add( "productUrl ", typeof(string ));
dt.Columns.Add( "title ", typeof(string));
dt.Columns.Add( "dateadd ", typeof(DateTime));
DataRow dr = dt.NewRow();
dr( "pictureID ") = " 1 ";
dr( "productUrl ") = ResolveUrl( "~/picture/1.jpg ");
dr( "title ") = "ad ";
dr( "dateadd ")=new DateTime (2006,1,15);
dt.Rows.Add(dr);
dr = dt.NewRow();
dr( "pictureID ") = 2;
dr( "productUrl ") = ResolveUrl( "~/picture/2.jpg ");
dr( "title ") = "ad ";
dr( "dateadd ") = new DateTime(2006, 7, 15);
dt.Rows.Add(dr);
dr = dt.NewRow();
dr( "pictureID ") = 3;
dr( "productUrl ") = ResolveUrl( "~/picture/3.jpg ");
dr( "title ") = "ads ";
dr( "dateadd ") = new DateTime(2006, 8, 15);
dt.Rows.Add(dr);
dr = dt.NewRow();
dr( "pictureID ") = 4;
dr( "productUrl ") = ResolveUrl( "~/picture/4.jpg ");
dr( "title ") = "adsa ";
dr( "dateadd ") = new DateTime(2006, 9, 15);
dt.Rows.Add(dr);
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
[解决办法]
不是方法,不用dr( " "),用dr[ " "]