小编Joh*_*ohn的帖子

无法登录SQL Server 2008 R2 Management Studio中的服务器

我有一个SQL Server 2008 R2实例,可以使用该sa用户登录.但我想定义另一个用户(administrator)使用SQL Server Management Studio登录,因此我执行了以下操作:

  • 以Management Studio身份登录到Management Studio中的服务器sa.
  • 右键单击数据库名称.
  • 点击属性.
  • 然后在许可下,我选择所需的用户名(administrator).
  • 我授予他所有许可.

但是当我尝试使用登录时administrator,我收到以下错误:

用户"administator"登录失败错误18456.

任何人都可以建议可能是什么问题?

sql-server authentication ssms sql-server-2008-r2

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

无法将类型'System.Linq.IQueryable <TMS.Models.CustomAsset>'隐式转换为'System.Collections.Generic.ICollection

我有以下模特课: -

public class CustomerCustomAssetJoin
{
    public CustomAsset CustomAsset  { get; set; }
    public ICollection<CustomAsset> CustomAssets { get; set; }

} 
Run Code Online (Sandbox Code Playgroud)

但是当我写下面的方法时: -

public CustomerCustomAssetJoin CustomerCustomAsset(string customerName)
{
    var customerAssets = tms.CustomAssets.Include(a => a.CustomAssetType).Where(a => a.CustomerName.ToLower() == customerName.ToLower());
    CustomerCustomAssetJoin caj = new CustomerCustomAssetJoin
    {
         CustomAsset = new CustomAsset {CustomerName = customerName },
         CustomAssets = customerAssets
    };
    return caj;  
 }
Run Code Online (Sandbox Code Playgroud)

我得到以下异常:

错误20无法将类型'System.Linq.IQueryable'隐式转换为'System.Collections.Generic.ICollection'.存在显式转换(您是否错过了演员?)

那是什么导致了这个错误?要克服此错误,我只需添加.toList(),如下所示:

var customerAssets = tms.CustomAssets.Include(a => a.CustomAssetType).Where(a => a.CustomerName.ToLower() == customerName.ToLower());
Run Code Online (Sandbox Code Playgroud)

那么为什么我必须将其转换为列表?

c# asp.net-mvc asp.net-mvc-4

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

如何强制Average函数包含空值?

我在asp.net mvc应用程序中写了以下内容:

double d = visits.Average(d=> d.amount);
Run Code Online (Sandbox Code Playgroud)

但是上面的代码会对任何Null的对象进行处理,在我的情况下返回一个不切实际的结果.如何强制平均函数计算平均值:

double d = visits.Sum(d=> d.amount)/visit.Count();
Run Code Online (Sandbox Code Playgroud)

c#

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

无法访问存储在App_Data文件夹中的图像

我的asp.net mvc Web应用程序中有以下链接: -

<a href="~/App_Data/uploads/38.png">@Model.Name</a>
Run Code Online (Sandbox Code Playgroud)

但是,当我点击此链接时,我收到以下错误:

HTTP错误404.8 - 未找到

请求过滤模块配置为拒绝URL中包含hiddenSegment部分的路径.

是什么导致了这个问题,以及我如何解决它?

谢谢

c# asp.net iis-7 asp.net-mvc-4

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

border-style:使用firefox时显示错误的虚线

我已经定义了以下insdie我的.css文件在我的页脚中显示一个虚线: -

.dash{
border-style:dashed ;
border-width:2px;
border-color:#322f32;
} 
Run Code Online (Sandbox Code Playgroud)

然后在页脚上我添加了以下内容: -

<hr/ class="dash">
Run Code Online (Sandbox Code Playgroud)

虚线表示将在Internet Explorer上很好地显示,但它不会在firefox上显示得很好,那么这背后的原因是什么,,,将这条虚线作为图像内部更安全吗?BR

css

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

如何在不使用图像的情况下显示正确和错误的符号

我正在使用asp.net mvc 3 web应用程序,我需要在我的应用程序中查看绿色的右标志和红色错误的标志,而不使用图像,这可能吗?,因为我在一些网站上注意到他们使用不同类型的标志但你无法下载为图像som这意味着它被显示为文本或使用Java脚本...?BR

html css

0
推荐指数
2
解决办法
4305
查看次数

从命令提示符调用控制台应用程序

我使用visual studio 2012创建了一个新的控制台应用程序.然后我导航到项目"...\bin\debug"中的以下位置,然后将.exe文件复制到C.现在我想从命令提示符调用此.exe文件,所以我写了以下内容: -

C:\>ConsoleApplication1.exe
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误: -

'ConsoleApplication1.exe' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)

这是我的控制台应用程序主要方法: -

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {

        static void Main(string[] args)
        {
            using (SkillManagementEntities sd = new SkillManagementEntities())
            {
                sd.Levels.Add(new Level() { Name = "from CA" });
                sd.SaveChanges();
            }

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我使用记事本打开.exe文件,我会得到以下它包含配置而不是实际的方法代码......: -

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, …
Run Code Online (Sandbox Code Playgroud)

c# asp.net exe console-application visual-studio-2012

-3
推荐指数
1
解决办法
1883
查看次数