家里的小乌龟生蛋了!
今天开QQ邮箱,发现我爸给我发了一封邮件,原来家里的巴西龟生蛋了!
原来,乌龟也可以像鸡一样生蛋,不用受精就可以,只不过孵不出小乌龟罢了。
看着它的照片,想起我在家那时候每天喂它吃虾,还曾经把活虾放在水盆里给它玩,真的好有意思啊。现在它居然生蛋了,原来,变老的不止我一个。。。。
升级到Firefox5之后Firebug不见了?
很早之前就升级到Firefox5了,然后firebug就不见了,但是右键菜单还是可以看到Inspect element,选择它就可以打开firebug,所以我一直就没处理firebug不见的问题。
今天有人说他的firebug也不见了,而且他的右键菜单没有Inspect element,这样他的firebug怎么都用不了了。很是郁闷。
原来,在Firefox5中,firebug的图标变成在右上角显示,状态栏那里变成默认不显示。不过不知道为什么,我的Firefox右上角也没有显示Firebug。
现在,我知道可以通过打开about:config,搜索extensions.firebug.showStatusIcon,双击它,将它的值改成true就可以了。给遇到同样问题的朋友参考一下。
耶,Firebug回来了。
CRM2011 添加按钮到subgrid的ribbon上
添加按钮到subgrid的ribbon上,并定义点击按钮执行的命令。
继续阅读 »
[CRM2011 javascript] Get entity id and run workflow
取得当前Form的entity id并执行workflow。
继续阅读 »
七宗罪 by Blackeri
此文目的在于记几个单词,欣赏几张插画。
这七宗罪,每个人或多或少都会有吧,
七宗罪:
Avarice(贪婪),Envy(嫉妒),Gluttony(饕餮),Lust(淫欲),Sloth(懒惰),Vanity(傲慢),Wrath(暴怒)
MSCRM4.0 交叉表查询
当两个实体是多对多的关系时,CRM会创建一个交叉表,查询这个交叉表的数据不能用RetrieveMultiple,而需要用Fecth方法。
如果你用RetrieveMultiple的话,会出现以下错误:
0×80040800
The ‘RetrieveMultiple’ method does not support entities of type ‘cust_list_cust_survey’.
Platform
怎样用Fecth方法呢?以下例子来自MSDN(Using Intersect Tables):
-
CrmAuthenticationToken token = new CrmAuthenticationToken();
-
token.AuthenticationType = 0;
-
token.OrganizationName = "AdventureWorksCycle";
-
-
CrmService service = new CrmService();
-
service.Url = ""http://:/mscrmservices/2007/crmservice.asmx";
-
service.CrmAuthenticationTokenValue = token;
-
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
-
-
// Get the GUID of the current user.
-
WhoAmIRequest who = new WhoAmIRequest();
-
WhoAmIResponse whoResp = (WhoAmIResponse)service.Execute(who);
-
-
Guid userid = whoResp.UserId;
-
-
// Create a query expression.
-
QueryExpression qe = new QueryExpression();
-
qe.EntityName = "role";
-
// Be aware that using AllColumns may adversely affect performance
-
// and cause unwanted cascading in subsequent updates.
-
// A best practice is to retrieve the least amount of data required.
-
qe.ColumnSet = new AllColumns();
-
-
// Create the link entity from role to systemuserroles.
-
LinkEntity le = new LinkEntity();
-
le.LinkFromEntityName = "role";
-
le.LinkFromAttributeName = "roleid";
-
le.LinkToEntityName = "systemuserroles";
-
le.LinkToAttributeName = "roleid";
-
-
LinkEntity le2 = new LinkEntity();
-
le2.LinkFromEntityName = "systemuserroles";
-
le2.LinkFromAttributeName = "systemuserid";
-
le2.LinkToEntityName = "systemuser";
-
le2.LinkToAttributeName = "systemuserid";
-
-
// Create the condition to test the user ID.
-
ConditionExpression ce = new ConditionExpression();
-
ce.AttributeName = "systemuserid";
-
ce.Operator = ConditionOperator.Equal;
-
ce.Values = new object[]{userid};
-
-
// Add the condition to the link entity.
-
le2.LinkCriteria = new FilterExpression();
-
le2.LinkCriteria.Conditions = new ConditionExpression[]{ce};
-
-
// Add the from and to links to the query.
-
le.LinkEntities = new LinkEntity[]{le2};
-
qe.LinkEntities = new LinkEntity[]{le};
-
-
// Retrieve the roles and write each one to the console.
-
BusinessEntityCollection bec = service.RetrieveMultiple(qe);
-
foreach (BusinessEntity e in bec.BusinessEntities)
-
{
-
role r = (role)e;
-
Console.WriteLine(r.name.ToString());
-
}
The FetchXML Wizard – 轻松生成CRM代码
-
INNER JOIN listmember ON listmember.entityid=lead.leadid
-
WHERE
-
listmember.listid='1E565422-A7AE-E011-958A-000C29295BC9'
-
AND lead.emailaddress1='test999@gmail.com'
以上语句转成c#代码是这个样子的:
-
-
QueryExpression query1 = new QueryExpression();
-
query1.EntityName = "lead";
-
ColumnSet columns1 = new ColumnSet();
-
columns1.Attributes = new string[] { "emailaddress1" };
-
query1.ColumnSet = columns1;
-
query1.Criteria = new FilterExpression();
-
query1.Criteria.FilterOperator = LogicalOperator.And;
-
query1.Criteria.Conditions = new ConditionExpression[] { condition1 };
-
-
LinkEntity linkEntityForLead = new LinkEntity();
-
linkEntityForLead.JoinOperator = JoinOperator.Natural;
-
linkEntityForLead.LinkFromEntityName = "lead";
-
linkEntityForLead.LinkFromAttributeName = "leadid";
-
linkEntityForLead.LinkToEntityName = "listmember";
-
linkEntityForLead.LinkToAttributeName = "entityid";
-
-
linkEntityForLead.LinkCriteria = new FilterExpression();
-
linkEntityForLead.LinkCriteria.FilterOperator = LogicalOperator.And;
-
-
linkEntity1.LinkCriteria.Conditions = new ConditionExpression[] { condition2 };
-
query1.LinkEntities = new LinkEntity[] { linkEntityForLead };
每次,当我写这些代码的时候,都很想死,同时觉得好爱sql哦。
今天我终于找到这么一个工具,可以直接生成c#代码!
那就是——The FetchXML Wizard(点击进入下载)
这个工具,只要输入CRM server的名字就可以了。然后根据需要选择相应的实体,条件,排序等等,好用极了。不知道我是不是out了今天才知道呃。。。
SQL批量插入数据的语句
菜鸟记录,高手无视。
-
DECLARE @MyCounter INT
-
-
SET @MyCounter = 0 /*设置变量*/
-
-
WHILE (@MyCounter < 2500) /*设置循环次数*/
-
-
BEGIN
-
-
-
-
/*这里是 insert 语句*/
-
-
-
-
SET @MyCounter = @MyCounter + 1
-
-
END




