我想获取在Windows应用程序的DropDown中显示的解决方案列表的列表。
因此,要获取我在#include "main.h"
int main(void)
{
volatile static uint16_t PortDataInput=0x00;
RCC->CR|=(uint32_t)0xF1; //set hsi clock source and with max speed
GPIOB_RCC->AHBENR|=(1<<18); //enable gpiob clock source
GPIOB->PUPDR|=0xAA; //set firt 4 bit of gpiob as pull down
GPIOB->MODER|=0x55555500; //set firt 4 bit of gpiob as input
GPIOB->OTYPER|=0x00000000; //set output pins of gpiob as push pull
while(1)
{
PortDataInput=GPIOB->IDR;
PortDataInput&=0xF;
}
下面编写的解决方案列表,并为其添加过滤器:
QueryExpression
但是它将在结果中返回0个实体。
我还尝试通过使用 LINQ 来搜索所有解决方案,如上面的代码注释行所添加。但是在那里 public EntityCollection GetSolutions(IOrganizationService service, string solutionUniqueNameLike)
{
QueryExpression querySampleSolution = new QueryExpression
{
EntityName = "solution",
ColumnSet = new ColumnSet(new string[] { "publisherid", "installedon", "version", "versionnumber", "friendlyname", "ismanaged", "uniquename" }),
Criteria = new FilterExpression()
};
querySampleSolution.Criteria.AddCondition("uniquename".ToLower(), ConditionOperator.Like, "*" + solutionUniqueNameLike.ToLower() + "*");
var solutions = service.RetrieveMultiple(querySampleSolution);
//var filteredSolutions = solutions.Entities.Where(e => (e.Attributes.Contains("uniquename")) && (e.Attributes["uniquename"].ToString().ToLower() == "*" + solutionUniqueNameLike + "*"));
if (solutions?.Entities?.Count > 0)
{
return solutions;
}
return null;
}
。
编辑1:当我尝试使用NULL
而不是类似条件时,它会引发如下错误:
System.ServiceModel.FaultException
Contains
2 行动) Microsoft.Xrm.Client.Services.OrganizationService.RetrieveMultiple(QueryBase 查询)在TestProjectForCRM.Program.Main(String [] args)中 C:\ Users \ pratik.soni \ source \ repos \ TestProjectForCRM \ TestProjectForCRM \ Program.cs:line 37
不确定我在这里缺少什么。
答案 0 :(得分:0)
当我如下使用 Like 运算符时,它会为我提供解决方案列表
// Define Condition Values
var QEsolution_uniquename = "%sprint%";
// Instantiate QueryExpression QEsolution
var QEsolution = new QueryExpression("solution");
// Add columns to QEsolution.ColumnSet
QEsolution.ColumnSet.AddColumns("friendlyname", "uniquename");
// Define filter QEsolution.Criteria
QEsolution.Criteria.AddCondition("uniquename", ConditionOperator.Like, QEsolution_uniquename);
但是当我尝试使用 contains 运算符时,它给我提供了错误的未知运算符。
答案 1 :(得分:0)
我想补充一下为什么您看到以下错误:
System.ServiceModel.FaultException1 HResult = 0x80131501消息=
SQL错误:通用SQL错误。 CRM错误代码:-2147204784 Sql
错误代码:-2146232060 SQL号:7601
有用的部分是 SQL号:7601 ,Database engine Events & Errors说Cannot use a CONTAINS or FREETEXT predicate on %S_MSG '%.*ls' because it is not full-text indexed.
Refer my blog关于如何破解此错误消息。