SQL 将多个列拼接成一行

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 获取网站或者应用程序路径


    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不才hm

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值