小编Aru*_*mar的帖子

.Net Framework 4.0中的SMO程序集

我使用的.NET Framework 4.0和Web部署安装工作,我已引用SQL Server 2008中的SMO大会,当我在使用SMO程序集我建立呼叫ExecuteNonQuery函数它给了我这个错误"混合模式组件对内置版本运行时的'v2.0.50727',如果没有其他配置信息,则无法在4.0运行时加载." 但有时它在我的代码中正常工作,但有时它会给出这个错误,

我使用相同的类,相同的方法有时它运行正确,有时它给出了这个错误,我完全消失了这个错误,我找不到任何理由,我也想知道SMO程序集是否可用在.Net framework v4.0中?

c# sql-server-2008

7
推荐指数
1
解决办法
6642
查看次数

向Rich Text编辑器Sitecore 8添加多个CSS类

我试图将CSS类添加到Sitecore 8中的Rich Text编辑器中。我在web.config中包括了对CSS文件的引用,如下所示

<settings>
  <setting name="WebStylesheet">
    <patch:attribute name="value">/Stylesheets/Corporate/rte.css</patch:attribute>
  </setting>
</settings>
Run Code Online (Sandbox Code Playgroud)

我的CSS类如下所示:

.utility.background-color-dark-blue:focus, .utility.background-color-dark-blue:hover {
  background-color: #034b76;
  color: #fff;
}
.utility.background-color-dark-grey {
  background-color: #1a1b1f;
  color: #fff;
}
Run Code Online (Sandbox Code Playgroud)

当我从RTE的下拉列表中选择CSS类时,它仅将“ background-color-dark-grey”类应用于该元素。我需要将CSS类应用为“ utility background-color-dark-grey”,以显示正确的样式。

有谁知道如何在sitecore中向RTE添加多个类?

c# sitecore rte sitecore8

5
推荐指数
1
解决办法
997
查看次数

根据CSV SQL中的批量插入更新列

我正在尝试根据CSV文件更新表.我有CSV列表的Id和修剪编号,我需要根据SQL表中的特定ID更新修剪编号.

到目前为止我写的脚本

-- Create a temporary table for the import
   drop table #InterpreterTrimNumbers
   CREATE TABLE #InterpreterTrimNumbers( 
  [SAPInterpreterId] int,
  TempTrimNumber varchar(100)
)

BEGIN TRANSACTION
  -- Bulk import into the temporary table
  BULK INSERT #InterpreterTrimNumbers FROM 'C:\CSVData\Trim numbers.csv' WITH (
    FIRSTROW = 2,
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n',
    ERRORFILE = 'C:\CSVData\Trim numbers-errors.csv',
    TABLOCK
  )

  update Interpreters set TrimNumber = (select TempTrimNumber from #InterpreterTrimNumbers where #InterpreterTrimNumbers.SAPInterpreterId = Interpreters.SAPInterpreterID )
  Commit Transaction
Run Code Online (Sandbox Code Playgroud)

即使CSV文件只有110条记录,这一行也会返回1824行.我只想用特定的SAPInterpreterID更新记录

任何帮助表示赞赏.

sql sql-server csv

4
推荐指数
1
解决办法
942
查看次数

字符串不应该以!开头!或=正则表达式

我正在寻找一个正则表达式,不允许字符串以'!'开头 或'='.这是我目前的代码,我只添加了'='的代码,但这些代码不起作用.

[RegularExpression("^(?!=)", ErrorMessageResourceName="Error_StringStartWith",      ErrorMessageResourceType= typeof(CommonStrings))]
public String FirstName { get; set; }
Run Code Online (Sandbox Code Playgroud)

c# regex asp.net-mvc

2
推荐指数
1
解决办法
280
查看次数

将X-Robot-Tag添加到Sitecore 8中的响应头

我在Sitecore有一个网站设置.我的站点地图是sitecore中的一个项目,位于主页下方.

我可以通过输入以下URL来访问我的站点地图:http: //example.com/xmlsitemap 而xmlsitemap是Sitecore中项目的名称.其中有渲染来获取下面给出的XML站点地图:

XmlDocument SiteMap = new XmlDocument();
SiteMap.Load(System.Web.HttpContext.Current.Server.MapPath("~/") + "//SiteMap//Sitemap-" + Sitecore.Context.Site.SiteInfo.Name + ".xml");
return this.Content(SiteMap.InnerXml, "text/xml");
Run Code Online (Sandbox Code Playgroud)

我在sitecore中有多个站点设置.这就是我将sitemap创建为sitecore中的Item的原因.这样它就可以为每个网站获得正确的站点地图.

问题是当我使用URL将此站点地图提交给谷歌时.它也会对站点地图网址建立索引,并且它会显示在实际结果中.

我知道我可以通过添加X-Robot-Tag:noindex来阻止谷歌索引我的站点地图.但我不能这样做,因为它不是网站目录中的项目.

关于如何实现这一点的任何想法?

c# sitemap asp.net-mvc sitecore sitecore8

1
推荐指数
1
解决办法
1682
查看次数

n-ary树中的搜索算法

我正在尝试为n-ary树实现搜索算法.以下是我写的代码:

public class Employee
{

    public int EmployeeId { get; set; }
    public string Level { get; set; }
    public int BillCode { get; set; }

    public virtual List<Employee> ReportsTo { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我需要在树上执行BFS以查找子节点中的元素,并在树中找到元素时停止递归.我到目前为止写的代码是:

static bool ClosestManager(Employee a, Employee b) //a contains all the tree elements and b is the one that I need to find
    {
      if (a.EmployeeId == b.EmployeeId)
            return true;
        if (a.ReportsTo != null)
        {
            foreach (var curremployee in a.ReportsTo)
            {
                ClosestManager(curremployee, b);
            }
        } …
Run Code Online (Sandbox Code Playgroud)

c# algorithm tree

1
推荐指数
1
解决办法
506
查看次数