相关疑难解决方法(0)

从SQL Server中的SELECT获取布尔值到C#中的bool?

我在SELECT中有这个代码:

SELECT  A.CompletedDate,
    CASE
        WHEN (@AdminTestId IS NULL AND @UserTestId IS NULL) THEN 0
        WHEN (@AdminTestId = temp.AdminTestId AND @UserTestId = A.UserTestId) THEN 1
        WHEN (@AdminTestId = temp.AdminTestId AND @UserTestId IS NULL) THEN 1
    ELSE 0
    END AS [Current], 
Run Code Online (Sandbox Code Playgroud)

在我的ASP.NET DTO中我有:

public partial class GetTestsDTO
{
    public bool? GradePass { get; set; }
    // the following line is what is giving the error. If I remove
    // the line it will not try to convert the data and there is …
Run Code Online (Sandbox Code Playgroud)

c# sql-server asp.net

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

从SQL存储过程返回BIT常量

好的,我正在尝试从存储过程中返回BIT常量.

我设法让它编译的唯一方法是使用强制转换:

CAST(0 AS BIT) AS MyBool

没有演员表是否有更有效的方式来写这个?

t-sql casting sql-server-2008 sqldatatypes

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