我想将字符串:转换24/11/2016 04:30 pm为datetime值:11/24/2016 04:30 pm.
我的代码为:
DateTime date = DateTime.ParseExact("24/11/2016 04:30 pm", "dd/MM/yyyy hh:mm aa", CultureInfo.InvariantCulture);
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误:
字符串未被识别为有效的DateTime.
我能做什么 ?
我有一张表 A :
ID | ProductCatId | ProductCode | Price
1 | 1 | PROD0001 | 2
2 | 2 | PROD0005 | 2
3 | 2 | PROD0005 | 2
4 | 3 | PROD0008 | 2
5 | 5 | PROD0009 | 2
6 | 7 | PROD0012 | 2
Run Code Online (Sandbox Code Playgroud)
我想选择 ID、ProductCatId、ProductCode、Price,条件为: “如果 ProductCatId 存在相同的值,则使用 max(ID) 获取 ProductCatId”,例如:
ID | ProductCatId | ProductCode | Price
1 | 1 | PROD0001 | 2
3 | 2 | PROD0005 …Run Code Online (Sandbox Code Playgroud)