小编Eri*_*tas的帖子

为什么我会得到"名称已存在的游标"?

我有这个触发器:

CREATE TRIGGER CHECKINGMAXQTYDAYSVACANCY
    ON TDINCI
AFTER INSERT 
AS
    DECLARE
        @incidentCode int,
        @dateStart datetime,
        @dateEnd datetime,
        @daysAccumulated int,
        @maxDaysAvailable int

    set @daysAccumulated = 0;

    select @incidentCode = CO_INCI from inserted;
    select @maxDaysAvailable = IN_DIAS_GANA from TCINCI
        where CO_INCI = @incidentCode;

    declare detailsCursor CURSOR FOR
        select FE_INIC, FE_FINA from TDINCI
        where CO_INCI = @incidentCode;

    open detailsCursor;

    if CURSOR_STATUS('variable', 'detailsCursor') >= 0
    begin
        fetch next from detailsCursor
            into @dateStart, @dateEnd;

        while @@FETCH_STATUS = 0
        begin
            set @daysAccumulated = @daysAccumulated + (DATEDIFF(DAY, @dateStart, …
Run Code Online (Sandbox Code Playgroud)

sql t-sql sql-server cursor

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

当我比较两个空列表时,为什么测试'Assert.AreEqual'失败了?

我有一个类MyCustomClass:

public MyCustomClass
{
    public MyCustomClass()
    {
        MyObject = new List<MyCustomObject>();
    }

    public List<MyCustomObject> MyObject {get; set;}
}
Run Code Online (Sandbox Code Playgroud)

在测试中:

List<MyCustomObject> aux = new List<MyCustomObject>();
MyCustomClass oClass = new MyCustomClass();
Assert.AreEqual(aux, oClass.MyObject)
Run Code Online (Sandbox Code Playgroud)

测试失败了,为什么?每个属性,静态成员等都是相同的.

c# unit-testing

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

如何使用ServiceAccountCredential认证的SpreadsheetsService?

我需要使用SpreadsheetsService,但我没有在官方文档中找到方法.net. https://developers.google.com/google-apps/spreadsheets/?hl=ja#authorizing_requests

我的服务已通过身份验证:

String serviceAccountEmail = "serviceAccount@developer.gserviceaccount.com";

var certificate = new X509Certificate2(@"privatekey.p12", "pass", X509KeyStorageFlags.Exportable);

ServiceAccountCredential credential = new ServiceAccountCredential(
    new ServiceAccountCredential.Initializer(serviceAccountEmail)
    {
        Scopes = new[] { DriveService.Scope.Drive }
    }.FromCertificate(certificate));
Run Code Online (Sandbox Code Playgroud)

从这里我可以实例化几乎任何服务.

例如Drive Service:

var service = new DriveService(new BaseClientService.Initializer()
    {
            HttpClientInitializer = credential,
            ApplicationName = "Drive API Sample",
    });
Run Code Online (Sandbox Code Playgroud)

但是SpreadsheetsService我可以这样做,因为SpreadsheetsService在他的默认构造函数或其属性中的GOAuth2RequestFactory中等待字符串'application name' RequestFactory.

如何使用ServiceAccountCredential对SpreadsheetsService进行身份验证?

.net google-api google-authentication google-sheets google-spreadsheet-api

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

如何使用Linq向订单添加订单(autoIncrement)属性?

有:

初始化anonymouse集合(我会将其作为json发送)

var myCollection = new[]
{
    new
    {
        Code = 0,
        Name = "",
        OtherAttribute = ""
    }

}.ToList();

myCollection.Clear();
Run Code Online (Sandbox Code Playgroud)

并获取数据.

myCollection = (from iPeople in ctx.Person
                join iAnotherTable in ctx.OtherTable
                on iPeople.Fk equals iAnotherTable.FK
                ...
                order by iPeople.Name ascending
                select new
                {
                    Code = iPeople.Code,
                    Name = iPeople.Name,
                    OtherAttribute = iAnotherTable.OtherAtribute
                }).ToList();
Run Code Online (Sandbox Code Playgroud)

我想添加一个Identity列,我需要订购的集合,并从1计数到collection.count.用于将此计数器绑定到表(jtable)中的列.

var myCollection = new[]
{
    new
    {
        Identity = 0,
        Code = 0,
        Name = "",
        OtherAttribute = ""
    }

}.ToList();

myCollection = (from iPeople …
Run Code Online (Sandbox Code Playgroud)

c# linq anonymous-types

4
推荐指数
2
解决办法
4854
查看次数

如何检查变量是否是 F# 中的整数?

我是 F# 新手。

如何检查变量是整数还是其他类型。

谢谢。

f# c#-to-f# f#-3.0

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

从页面中选择所有'a'元素?

我想选择一个链接some text然后我把:

$("a[text='some text']")
Run Code Online (Sandbox Code Playgroud)

但是没有用,那么我想测试从页面中选择所有链接.

$("a")
Run Code Online (Sandbox Code Playgroud)

但是这个jquery select指令只给了我页面的第一个或者最重要的链接.

为什么?

这里有一个例子: 选择链接

提前致谢.

html javascript jquery dom jquery-selectors

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