惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
D
DataBreaches.Net
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
GbyAI
GbyAI
美团技术团队
云风的 BLOG
云风的 BLOG
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
博客园 - 叶小钗
Engineering at Meta
Engineering at Meta
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
阮一峰的网络日志
阮一峰的网络日志
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
U
Unit 42
P
Proofpoint News Feed
V
V2EX

博客园 - upzone

FTP Handler cannot be hosted in x64 Host instance Next Release of BizTalk Server: BizTalk Server 2010 R2 Passed MS BI Certification: 70-448 Passed new BizTalk Certification: 70-595 FW: BizTalk's furture OLAP Architectures Comparison (ROLAP, MOLAP, HOLAP) 远程桌面访问Matlab的方法 FW: BIZTALK: Cannot perform encryption or decryption because the secret is not available from the master secret server 401 Unauthorized when call WCF in BizTalk,The authentication header received from the server was 'Negotiate,NTLM' - upzone Matlab first Prog. Visual Studio 2008: Install New Project Template SQL Server 兼容模式 FW: HTTP错误500显示具体的出错信息的方法 XmlSerialize error: There was an error generating the XML document. 装了Visual Studio 2010 后 Enterprise Single Sign-On 无法启动. Javascript 实现延迟跳转 - upzone - 博客园 六一,外公走了 FW: MOSS SSP Failed to provision - No running instances of Shared Services Provider provisioning TFS Build Notification: TFS 30063, you are not authorized to access the tfs
Issue when try to get select count using Linq to SQL
upzone · 2010-06-21 · via 博客园 - upzone

Issue:

DataBase sp:

select count(*) from training where domain = @domain and username = @username

Linq: TrainingDatabase.dbml

Main Class:

TrainingDataBaseDataContext context = new TrainingDataBaseDataContext("Data Source=.;Initial Catalog=Training;Integrated Security=True");
var results = context.spGetUserCompletion("psdcrm", "administrator");
foreach (var result in results)
{
      if (result.Column1.HasValue && result.Column1.Value > 0)
      {
            Console.WriteLine("TRUE");
      }
}

I except to get one line "true", but failed.

Cause:

Maybe Linq cannot map computed column to the Column1 entity.

Solution:

try to modify the sp and add the alias column name just like below:

select count(*) as Column1 from training where domain = @domain and username = @username