小编Sha*_*hay的帖子

最后在SQL Server 2000中插入UNIQUEIDENTIFIER

OUTPUT子句与SQL Server 2005兼容,但不兼容SQL Server 2000.

如何将此命令转换为在SQL Server 2000中工作?

CREATE TABLE sample
(
 ID uniqueidentifier NOT NULL DEFAULT newid(),
 Title varchar(30) NOT NULL
)

INSERT INTO sample (Title)
OUTPUT INSERTED.ID
VALUES ('Test1')
Run Code Online (Sandbox Code Playgroud)

我需要命令来检索ID,因为INSERT需要从存储过程调用该命令.

谢谢你的帮助!

sql-server-2000 uniqueidentifier newid

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

Comparing a nullable column throws "Unable to cast the type..." exception

My entity NewsItem has a nullable foreign key property: LibraryID of type int?.

My issue is when I query the property and compare it with any value except null, I get exceptions.

Initially my code was:

int? lid = ...
var results = context.NewsItems
    .Where(n => n.LibraryID == lid);
Run Code Online (Sandbox Code Playgroud)

but it gives me no results at all, no matter what lid is.

So, I tried:

var results = context.NewsItems
    .Where(n => n.LibraryID.Equals(lid));
Run Code Online (Sandbox Code Playgroud)

gives exception:

Unable to create a …

c# linq-to-entities entity-framework-5

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

角度UI模态打开的承诺在模态显示之前解决

我试图在打开的模式上执行jQuery脚本,以便将其中一个字段转换为a jQuery UI Spinner.

我正在使用Angular UI中opened记录的承诺.

问题: jQuery选择器无法按预期工作,也无法检索任何内容.

所以我的控制器的一个功能看起来像这样:

var modalInstance = $modal.open({
    templateUrl: 'modalDialog.html',
    controller: modalCtrl,
    resolve: {
        noOfItems: function(){
            return $scope.noOfItems;
        }
    }
});

modalInstance.opened
    .then(function () {
        $(".spinner").spinner({
            max: 20,
            min: 1
        });
    });

modalInstance.result
    .then(function () {
        console.log("modal closed");
    });
Run Code Online (Sandbox Code Playgroud)

我的HTML:

<script type="text/ng-template" id="modalDialog.html">
    <div class="modal-header">
        <h4 class="modal-title">My Modal</h4>
    </div>
    <div class="modal-body">
        <input class="form-control spinner" type="text" ng-model="noOfItems" />
    </div>
    <div class="modal-footer">
        <button class="btn btn-default" ng-click="cancel()">Cancel</button>
        <button class="btn btn-primary" ng-click="save()">Save</button>
    </div>
</script>
Run Code Online (Sandbox Code Playgroud)

这 …

jquery jquery-ui angularjs angular-ui-bootstrap

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

如何在MongoDB C#Driver 2.0中记录我的查询?

刚刚将我的应用程序升级到最新的稳定的MongoDB C#Driver 2.0.

在迁移过程中,基本功能已被破坏,甚至最简单的查询如下:this.collection.Find(e => e.Id == id).SingleOrDefaultAsync()不返回正确的数据.

检查了类映射和约定,但我希望看到输出查询以正确识别问题.

那么,如何做到这一点MongoClient呢?

在数据库级别设置分析是可能的,但不是一个好的解决方案,因为我们有几个应用程序和开发人员使用数据库.

我的应用程序是目前正在使用Ninject.Extensions.Logging,并log4net在用户界面,业务和EF数据访问.

c# logging mongodb mongodb-csharp-2.0 mongodb-.net-driver

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