小编Sta*_*ace的帖子

使用大于登录CASE表达式的tsql

(case [dbo].[YearsInService]([DateEngaged],getdate())
   when (0) then (0) 
   when (1) then (4) 
   when (2) then (8)
    when (3) then (12)
     when (4) then (32) 
     when (5) then (40) 
     when (6) then (48) 
     when (7) then (56) 
     when (8) then (104) 
     when (9) then (117) 
     when (10) then (150) else (-1) end)
Run Code Online (Sandbox Code Playgroud)

现在在我的最后一行,我怎么能说10和以上应该返回150?

t-sql sql-server case

10
推荐指数
2
解决办法
3万
查看次数

带有Update 5的Microsoft Visual Studio Ultimate 2013

我正在寻找一个结合了Visual Studio Ultimate 2013(原始版本)和Visual Studio 2013 Update 5的ISO.

我只想拥有一个可以运行的ISO并安装VS 2013并使用更新5.

我已经搜索了但是所有人都可以获得这个https://www.microsoft.com/en-us/download/details.aspx?id=48144这是一个在线安装.

那么有没有人知道我可以下载VS2013 Ultimate ISO的链接,它也有更新5,就像上面链接中的在线安装程序一样?

visual-studio visual-studio-2013

10
推荐指数
3
解决办法
4万
查看次数

应用程序要求首先在全局程序集缓存中安装程序集microsoft.reportviewer.processingObjectModel版本11.0.0.0

我有一个在Visual Studio 2012中创建的小窗体应用程序,它使用ReportViewer版本11.0.0.0.

应用程序目标框架是.NET 4.0,其部署方法是ClickOnce

在我的PC上它安装,但在客户端机器上,安装失败并出错

应用程序要求首先在全局程序集缓存中安装程序集microsoft.reportviewer.processingObjectModel版本11.0.0.0.

在客户端机器上,我已安装

  • .NET 4.0
  • ReportViewer 2010
  • Microsoft Report Viewer 2012运行时CTP
  • SQLSYSCLRTYPES.msi

在项目应用程序文件设置中,我已将microsoft.reportviewer.processingObjectModel 发布状态设置为Include(Auto),在引用中我还将其Copy Local属性设置为True.

我错过了什么?

我甚至按照这里的说明http://msdn.microsoft.com/en-us/library/ms251723.aspx

reportviewer gac .net-4.0 visual-studio-2012

8
推荐指数
2
解决办法
4万
查看次数

将dataGridView行导出到Excel或SQL Server数据库的最快方法是什么

什么是将460328 - 800328范围内的DataGridView行导出到Excel或SQL Server数据库表中而不使用Microsoft Office互操作作为互操作的最快方法是在系统资源上非常缓慢和繁重?

c# datagridview streamwriter

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

如何从linq到实体查询获取toTraceString()?

dynamic traceFile =  Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\EntityFrameworkTrace.log";                
var CurrentStock = (from s in DBViews.StockStatus
                    where s.ProductID != 10
                    orderby s.ProductName
                    select new
                    {
                        s.ProductID,
                        s.ProductName,
                        CurrentStock = s.TotalStocked - s.TotalSold,
                        s.CurrentSellingRate,
                        CashValue = (s.TotalStocked - s.TotalSold) * s.CurrentSellingRate,
                        s.LastStocked,
                        s.LastCostPrice,
                        s.LastQtyStocked
                    }).ToList();

File.AppendAllText(traceFile, CurrentStock.toTraceString());   
return CurrentStock.ToList();
Run Code Online (Sandbox Code Playgroud)

如何从CurrentStock上获取toTraceString()在以下行?它没有得到解决

File.AppendAllText(traceFile,  CurrentStock.toTraceString()); 
Run Code Online (Sandbox Code Playgroud)

.net c# linq-to-entities entity-framework

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

如何在建立上下文时设置连接超时 - PrincipalContext

using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, Domain, UserName, Password))
            {
                UserPrincipal U = new UserPrincipal(ctx);
                U.GivenName = strFirstName;
                U.Surname = strLastName;
                U.EmailAddress = strEmail;

                PrincipalSearcher srch = new PrincipalSearcher(U);

                foreach (var principal in srch.FindAll())
                {
                    var p = (UserPrincipal)principal;
                    if (!User.Any(x => x.Email == p.EmailAddress))
                    {
                        MyUserDataset.UserRow User = User.NewUserRow();
                        User.FirstName = p.GivenName;
                        User.LastName = p.Surname;
                        User.UserName = p.SamAccountName;
                        User.Email = p.EmailAddress;
                        User.AddUserRow(User);
                    }
                }
                User.AcceptChanges();
            }
Run Code Online (Sandbox Code Playgroud)

我正在使用上面的PrincipalContext类来建立与目标目录的连接,并指定用于对目录执行操作的凭据.

有没有人知道如何在PrincipalContext构造函数中指定连接超时?我遇到连接超时问题我想知道我是否可以控制连接超时多长时间.

c# directoryservices adsi c#-4.0 principalcontext

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

如何获取sql server 2005中两个日期之间的月份数

我的sql server 2005表中有一列应该保存员工服务的月数.

由于我也有员工参与的日期,我希望"months_In_Service"列成为计算列.

现在,如果我DATEDIFF(month,[DateEngaged],GETDATE())用作服务计算列中月份的公式,则结果有时是正确的,有时则不正确.

获得DateEngaged值和当前日期之间的月数的更可靠的方法是什么?我应该在计算列中使用哪个公式?

sql t-sql sql-server datetime datediff

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

将Windows窗体用户控件拖动到窗体时出现错误“无法创建组件'ControlName'”

我的项目中有一个Windows窗体用户控件。它一直在没有任何问题的形式上工作,但突然我不能在其他任何形式上使用它。如果我尝试将其从工具箱中拖动到新窗体,则会收到此错误消息

“无法创建控件'controlName'。错误消息如下:system.ArgumentException:在配置中找不到指定的命名连接,不打算与EntityClient提供程序一起使用或无效。”

但是当我运行该项目时,它编译时没有任何错误。

另外,当我想打开已经包含此Usercontrol且运行良好的表单的设计器时,设计器无法加载,并且我在下面看到错误消息

“为了防止在加载设计器之前可能丢失数据,必须解决以下错误:

在配置中找不到指定的命名连接,或者不打算与EntityClient提供程序一起使用,或者无效。

变量'MyControlName1'未声明或从未分配。”

我不了解发生了什么,但该项目仍在构建和运行,但是肯定有严重错误。

winforms

5
推荐指数
2
解决办法
9365
查看次数

如何正确解析由空格分隔的文本文件

下面是我的示例文本文件

在此处输入图片说明 {

这是我的架构文件

[Sample File.txt]
ColNameHeader=True
Format=TabDelimited
CharacterSet=ANSI
Run Code Online (Sandbox Code Playgroud)

这是我迄今为止编写的用于尝试读取上述示例文件的代码,从上面的文本文件中读取的数据行应该返回以在 dataGridView 控件中显示。问题是,它作为单列返回,但我想使用这些空格作为列分隔符。我尝试了不同的字符分隔符,但没有成功。

public DataSet LoadCSV(int numberOfRows)
    {
        DataSet ds = new DataSet();
            // Creates and opens an ODBC connection
            string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + this.dirCSV.Trim() + ";Extensions=asc,csv,tab,txt;Persist Security Info=False";

            string sql_select;
            OdbcConnection conn;
            conn = new OdbcConnection(strConnString.Trim());
            conn.Open();

            //Creates the select command text
            if (numberOfRows == -1)
            {
                sql_select = "select * from [" + this.FileNevCSV.Trim() + "]";
            }
            else
            {
                sql_select = "select top " + …
Run Code Online (Sandbox Code Playgroud)

c# odbc text-files text-driver

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

如何动态更改/设置checkedListBox项前颜色

我有下面的代码.我如何设置checkListBox项目前颜色取决于是否选中项目?

private void FindSelectedUserRoles()
{
        lblSelectedUser.Text = Code.CommonUtilities.getDgvStringColValue(dataGridViewUserList, "UserName").Trim();

        //iterate all roles selected user is member of
        for (int i = 0; i < checkedListRoles.Items.Count; i++)
        {
            string roleName = checkedListRoles.Items[i].ToString();
            string selectedUserRoles = Code.MemberShipManager.GetSpecificUsersRoles(lblSelectedUser.Text.Trim());

            if (selectedUserRoles.Contains(roleName))
            {
                checkedListRoles.SetItemChecked(i, true);
                //here i want to set item fore colour to green

            }
            else if (selectedUserRoles.Contains(roleName) == false)
            {
                checkedListRoles.SetItemChecked(i, false);
                //and here, i want item fore colour to remain black
            }
        }
}
Run Code Online (Sandbox Code Playgroud)

c# checkedlistbox winforms

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