- 爱易网页
-
ASP.NET教程
- 请帮小弟我看下这个程序,小弟我搞了半个晚上运行是出错
日期:2014-05-19 浏览次数:20485 次
请各位高手帮我看下这个程序,我搞了半个晚上运行是出错啊
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();
------解决方案--------------------