I'm coding something like this.
dsSchedule = new DataSet();
dtSchedule = new DataTable();
dtSchedule.Columns.Add("JulianDate");
dtSchedule.Columns.Add("CalenderDay");
dsSchedule.Tables.Add(dtSchedule);DataRow drDay = dsSchedule.Tables["dtSchedule"].NewRow();
Does this DataRow need instatiation?? What am I missing here?
What I wanted to do was to build a DataTable dynamically and use it as a source to a DataGrid but this run time error stated in the subject is what I get.
ThanksYou're getting a NulReferenceException because the Tables collection of the DataSet doesn't have a Table named "dtSchedule".
If you want to index the Tables collection by name, you need to create your DataTable with a name:
dtSchedule = new DataTable("dtSchedule");
0 comments:
Post a Comment