我正在尝试使用具有'的名称在qbo中查询客户。例如(Joe' s Shop)并得到上述错误。
这是代码。
IEnumerable<Customer> customers = customerQueryService.Where(c => c.DisplayName =="Joe's Shop");
if (customers.Count()!=0 )
{
customer = customers.First();
}
return customer;
答案 0 :(得分:0)
请使用反斜杠来逃避单引号。
“乔的商店”
由于
答案 1 :(得分:0)
using Intuit.Ipp.Core;
using Intuit.Ipp.Data;
using Intuit.Ipp.LinqExtender;
using Intuit.Ipp.QueryFilter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
static class SampleCalls
{
public static Customer QueryCustomerByDisplayName(ServiceContext context, string displayName) {
displayName = displayName.Replace("'", "\\'"); //Escape special characters
QueryService<Customer> customerQueryService = new QueryService<Customer>(context);
return customerQueryService.Where(m => m.DisplayName == displayName).FirstOrDefault();
}
}