我如何将词典附加到另一个词典?
Dictionary<string, DateTime> odict = new Dictionary<string, DateTime>();
//Liste tous les Clients EMAIL (3)
foreach (var TheClientID in TheClient.GetClient_Id(3))
{
Dictionary<string, DateTime> Temp = oEmail.VoirEML(TheClientID.Key);
//odict = odict.Concat(Temp).ToDictionary(pair => pair.Key, pair => pair.Value);
odict = odict.SelectMany(toto => Temp)
.ToLookup(pair => pair.Key, pair => pair.Value)
.ToDictionary(group => group.Key, group => group.First());
}
Run Code Online (Sandbox Code Playgroud)
我想连续/追加字典,而不是双重条目.
我有一个主要表单,其中包含一个打开子表单的菜单:
public Le_MainForm()
{
InitializeComponent();
this.IsMdiContainer = true;
.....
}
private void barButtonItem_CreatOrdreAller_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
Close_AllForm();
Program.StatusOrdre = 1;
Program.AllerRetour = "Ordre Aller";
Fiche_Ordre f_Fiche = new Fiche_Ordre();
f_Fiche.MdiParent = this;
f_Fiche.Show();
}
Run Code Online (Sandbox Code Playgroud)
效果很好,但是我从孩子那里打开另一个表格,我失去了MdiParent:
public Liste_Ordres()
{
InitializeComponent();
....
}
private void Liste_DobleClic(object sender, EventArgs e)
{
Fiche_Ordre f_Fiche = new Fiche_Ordre(gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString());
f_Fiche.ShowDialog();
}
Run Code Online (Sandbox Code Playgroud) 我有这张桌子:
代码包重量
-------------------
11 2 20
12 1 45
11 1 15
12 4 15
我怎样才能得到结果:
代码包重量
-------------------
11 3 35
12 5 60
先谢谢你,Stev
我正在使用C#Framework 4.0 Windows窗体.我的程序安装在服务器TSE上.有11个轻客户端连接到此服务器.
当其中一个客户启动我的程序时,我怎样才能获得他的PC名称?
以下哪种方法更适合关闭SqlDataReader:
SqlDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
}
reader.Close();
reader.Dispose();
Run Code Online (Sandbox Code Playgroud)
要么
SqlDataReader reader = comm.ExecuteReader(CommandBehavior.CloseConnection);
while (reader.Read())
{
}
Run Code Online (Sandbox Code Playgroud)
或者还有另一种关闭方法?
我有代码来查找sqlserver的列表
public static string[] GetSQLServerList()
{
SqlDataSourceEnumerator dse = SqlDataSourceEnumerator.Instance;
DataTable dt = dse.GetDataSources();
if (dt.Rows.Count == 0)
{
return null;
}
string[] SQLServers = new string[dt.Rows.Count];
int f = -1;
foreach (DataRow r in dt.Rows)
{
string SQLServer = r["ServerName"].ToString();
string Instance = r["InstanceName"].ToString();
if (Instance != null && !string.IsNullOrEmpty(Instance))
{
SQLServer += "\\" + Instance;
}
SQLServers[System.Math.Max(System.Threading.Interlocked.Increment(ref f), f - 1)] = SQLServer;
}
Array.Sort(SQLServers);
return SQLServers;
}
Run Code Online (Sandbox Code Playgroud)
它工作正常(如果找到SQL Server),但遗憾的是它无法找到sql Express.
有谁有想法?
提前谢谢你
我有字符串标记[5] = 8月和字符串标记[6] = 1(见图像
)
我想转换为DateTime.
我尝试:
DateTime DateCreated = DateTime.ParseExact(tokens[5] + tokens[6], "MM-dd", CultureInfo.InvariantCulture);
Run Code Online (Sandbox Code Playgroud) c# ×6
append ×1
concat ×1
converter ×1
count ×1
dao ×1
datetime ×1
dictionary ×1
group-by ×1
mdiparent ×1
sql ×1
sql-server ×1
sqlcommand ×1
thin-client ×1
winforms ×1