If txtSearchString.Text.Trim <> "" Then
Dim searchString As String = txtSearchString.Text.Trim
Dim results As EnumerableRowCollection(Of DataRow) = From PO In FilterPurchaseOrders().AsEnumerable() _
Where PO("Title") Like searchString Or PO("PONumber") Like searchString _
Or PO("Remarks") Like searchString Or PO("Note") Like searchString _
Or PO("Vendor") Like searchString Or PO("ShipTo") Like searchString _
Or PO("Lookup") Like searchString Or PO("BillTo") Like searchString _
Or PO("Status") Like searchString Or PO("Choice") Like searchString _
Select PO
rgPurchaseOrders.DataSource = results
End If
我收到此错误:错误BC30205:预期结束语。
FilterPurchaseOrders()函数返回一个数据表。
上述代码有什么问题?
答案 0 :(得分:0)
好吧,你的End If与你的网格数据源的分配在同一行,但这也会导致“If语句必须有匹配的结束If”......除非你有另一个End If代码之后片段,然后你会得到“预期结束语”。即:
If txtSearchString.Text.Trim <> "" Then
Dim searchString As String = txtSearchString.Text.Trim
Dim results = From PO In FilterPurchaseOrders().AsEnumerable() _
Where PO("Title") Like searchString Or PO("PONumber") Like searchString _
Or PO("Remarks") Like searchString Or PO("Note") Like searchString _
Or PO("Vendor") Like searchString Or PO("ShipTo") Like searchString _
Or PO("Lookup") Like searchString Or PO("BillTo") Like searchString _
Or PO("Status") Like searchString Or PO("Choice") Like searchString _
Select PO
rgPurchaseOrders.DataSource = results **End If**
End If
答案 1 :(得分:0)
Dev Server上的SharePoint站点未配置为使用.net 3.5。我做了以下web.config更改,它开始像魅力一样工作
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>