当你得到这个错误"字符常量必须只包含一个字符"
我有这个代码,但它经常给我上面的错误在我的LinqDataSource:
<asp:LinqDataSource ID="LinqViewLogs" runat="server"
ContextTypeName="ScanFakDataContext" OrderBy="Dato desc"
TableName="ViewLogs"
Where="(@Filter='' OR (@Filter='UserNotes' AND LogType=1)">
<WhereParameters>
<asp:QueryStringParameter DbType="String" DefaultValue="" Name="Filter" QueryStringField="Filter" />
</WhereParameters>
</asp:LinqDataSource>
问题是将引号颠倒,因此""
是''
, ''
是""
<asp:LinqDataSource ID="LinqViewLogs" runat="server"
ContextTypeName="ScanFakDataContext" OrderBy="Dato desc"
TableName="ViewLogs"
Where='(@Filter="" OR (@Filter="UserNotes" AND LogType=1)'>
<WhereParameters>
<asp:QueryStringParameter DbType="String" DefaultValue="" Name="Filter" QueryStringField="Filter" />
</WhereParameters>
</asp:LinqDataSource>