以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  出现语法错误!求教!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=26713)

--  作者:xietan417
--  发布时间:2012/12/12 14:03:00
--  出现语法错误!求教!
Dim Filter As String
With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "[CardNo] = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("SD")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "[FDateTime] >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("ED")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "[FDateTime] <= #" & .Value & "#"
    End If
End With
DataTables("考勤数据").LoadFilter = Filter
DataTables("考勤数据").Load()


我这样的代码运行的时候提示这样的错误!

.NET Framework 版本:2.0.50727.3643
Foxtable 版本:2012.11.28.1
错误所在事件:
详细错误信息:
System.Data.OleDb.OleDbException: \'#\' 附近有语法错误。
   在 System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
   在 System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
   在 System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
   在 System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
   在 System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   在 System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
   在 System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   在 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   在 System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   在 System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   在 Foxtable.DataTable.Load(Boolean OllOl1OO)

--  作者:lin_hailun
--  发布时间:2012/12/12 14:45:00
--  
 你的外部数据源是sqlserver 吗?如果是把#换成\'

--  作者:xietan417
--  发布时间:2012/12/13 10:39:00
--  
是的!我改了!的确是是这个原因!谢啦!图片点击可在新窗口打开查看