当您收到此错误时#34; 字符常量必须包含一个字符"
我有这个代码,但它在我的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>
答案 0 :(得分:1)
问题是要撤销引号,因此""
为''
,''
为""
这是正确的代码:
<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>