1 /*SQL 将多个列拼接成一行*/
原理:运用 for xml path('')语句,将每列数据拼接为节点为列名的XML,如果列名为无列名
select stuff(
(select ',' + shop_name from Shop
where Shop_ID IN ( SHOPID1,SHOPID2)
for xml path('') ),
1,
1,
''
)
from Bas_Shop
where Shop_ID IN (SHOPID1,SHOPID2)
select '' +Shop_ID , '' +Shop_Name from Shop for xml path('')
2 /*任务栏不显示*/
this.ShowInTaskbar =false
3 /*文本框快捷全选*/
private void txt_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.A)
{
((TextBox)sender).SelectAll();
}
}
4 简单记录日志
using (StreamWriter sw = new StreamWriter(Application.StartupPath + "\\PrintLog.txt", true))
{
sw.WriteLine("记录内容:XXXXXXXXXXX!");
}
或者:
using (StreamWriter sw = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "\\PrintLog.txt", true))
{
sw.WriteLine("记录内容:XXXXXXXXXXX!");
}
AppDomain.CurrentDomain.BaseDirectory 和 Application.StartupPath 获取网站或者应用程序路径