我有一个SQL Server 2008 R2实例,可以使用该sa用户登录.但我想定义另一个用户(administrator)使用SQL Server Management Studio登录,因此我执行了以下操作:
sa.administrator).但是当我尝试使用登录时administrator,我收到以下错误:
用户"administator"登录失败错误18456.
任何人都可以建议可能是什么问题?
我有以下模特课: -
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)
那么为什么我必须将其转换为列表?
我在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) 我的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部分的路径.
是什么导致了这个问题,以及我如何解决它?
谢谢
我已经定义了以下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
我正在使用asp.net mvc 3 web应用程序,我需要在我的应用程序中查看绿色的右标志和红色错误的标志,而不使用图像,这可能吗?,因为我在一些网站上注意到他们使用不同类型的标志但你无法下载为图像som这意味着它被显示为文本或使用Java脚本...?BR
我使用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)