dateTimePicker2.Text = dataset.Tables["costInformation"].ToString();
这句有明显的错误。dateTimePicker2是一个日期控件,它的Text属性应该设置为日期类型的字符串,如“2011年08月22日”。但你赋值的是一个表的名称,所以会出错。
按你的意思应该这样写:
dateTimePicker2.value = (DateTime)dataset.Tables["costInformation].Rows[0]["startTime"];
dateTimePicker2.Text = dataset.Tables["costInformation"].ToString();
改为
dateTimePicker2.Text = dataset.Tables["costInformation"].Rows[0][0].ToString();
dateTimePicker2.Text = dataset.Tables[0]["costInformation"].ToString();
dataset.tables[0].rows[0]["startTime"]