datatable().select报错

非非非非 2021-06-11 16:23:27

报错信息:

2021-06-11 15:27:15,448 [1] ERROR  - FLIGHT_DATE:FLIGHT_DATE = DATE'2021-04-01' and FLIGHT_CODE='CF9019' and DEPARTURE_AIRPORT='ZGGG' and ARRIVAL_AIRPORT='ZBAD' AND AIRCRAFT_CODE='B2135'
********************************************
2021-06-11 15:27:15,448 [1] ERROR  - 错误
System.Data.SyntaxErrorException: Syntax error: Missing operand after ''2021-04-01'' operator.
   at Aero.Airp.Client.frmAcarsParseView.barButtonItem2_ItemClick(Object sender, ItemClickEventArgs e)
   at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
   at DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
   at DevExpress.XtraBars.BarItemLink.OnLinkClick()
   at DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
   at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
   at DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)
   at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
   at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
   at DevExpress.XtraBars.Controls.CustomLinksControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.XtraBars.Controls.DockedBarControl.WndProc(Message& msg)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

 

代码信息:

 

  DataRow[] Rows = ds.Tables[0].Select(string.Format("FLIGHT_DATE = DATE'2021-04-01' and FLIGHT_CODE='CF9019' and DEPARTURE_AIRPORT='ZGGG' and ARRIVAL_AIRPORT='ZBAD' AND AIRCRAFT_CODE='B2135'"));
                           

...全文
891 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuzuning 2021-06-14

FLIGHT_DATE:FLIGHT_DATE = '2021-04-01'

 

  • 打赏
  • 举报
回复 1
非非非非 2021-06-15
@xuzuning 是select方法里边不能做date转换吗,我去掉date就好了
  • 举报
回复
发帖
C#

10.8w+

社区成员

.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
帖子事件
创建了帖子
2021-06-11 16:23
社区公告

让您成为最强悍的C#开发者