小编ema*_*man的帖子

如何避免字典中的空键错误?

如果key为null,如何避免错误?

//Getter/setter
public static Dictionary<string, string> Dictionary
{
    get { return Global.dictionary; }
    set { Global.dictionary = value; }
}
Run Code Online (Sandbox Code Playgroud)

更新:

Dictionary.Add("Key1", "Text1");
Dictionary["Key2"] <-error! so what can I write in the GET to avoid error?
Run Code Online (Sandbox Code Playgroud)

谢谢.

问候

c# static-methods

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

如何获取sql中的缺失值?

我需要帮助。

我有一个与另外两个表 t1 和 t3 相关的 sql 表 t2。

t2 有字段:

idFromt3 idFromt1 Value

1        14        text1
2        14        text2
1        44        text1
2        44        text2
3        44        text3
Run Code Online (Sandbox Code Playgroud)

我正在寻找缺少 ifFromt3 的值。我想在这个例子中找到值 ifFromt3 = 3,因为它不存在。

我正在像这个例子那样做,但它不能正常工作。

SELECT t3.idFromt3, t3.idFromt1
FROM t3 
  INNER JOIN t2 
    ON t3.LanguageMessageCodeID <> t2.idFromt2
Run Code Online (Sandbox Code Playgroud)

这是3张桌子。

CREATE TABLE [dbo].[t3](
    [t3ID] [int] IDENTITY(1,1) NOT NULL,
    [Name] [varchar](50) NOT NULL,
)

CREATE TABLE [dbo].[t2](
    [t2ID] [int] IDENTITY(1,1) NOT NULL,
    [t3ID] [int] NOT NULL,
    [t1ID] [int] NOT NULL,
)


CREATE …
Run Code Online (Sandbox Code Playgroud)

sql

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

标签 统计

c# ×1

sql ×1

static-methods ×1