Linq我不太好,我想查询以获取正确的数据。我有一个DataTable与此列:我如何从Linq的Column中获取正确的数据
我想通过列TIMEFROM和TIMETO DataTable中获得获得此= 2012年12月10日 不是2012年12月10日00:00:00。
我该如何做到这一点:我的数据表的名称是表。
MySqlCommand selectcommand = new MySqlCommand(sqlcommand, connection);
MySqlDataAdapter adapter = new MySqlDataAdapter(selectcommand);
DataTable table = new DataTable(TABLE);
adapter.Fill(table);
table = table.AsEnumerable().Where(r => r.Field<int>("Activate") == 1).CopyToDataTable();
//i need the shorter form
connection.Open();
selectcommand.ExecuteReader();
return table;
你是什么意思的列?你想只是日期,并缩短它们或整个表从时间到? –
认为图像没有正确上传。 –
若要从DateTime对象中省略小时,请使用.ToString(“d”) –