zoukankan      html  css  js  c++  java
  • C# 基础知识小结

    设置操作系统日期格式

    //公司电脑各式各样的都有,里面的设置也有很多不统一的,我们做软件一般会从系统中获取一些数据,比如日期时间,
    //环境变量的路径参数,可以用批处理文件达到我们所想要的目的,也可以用C#代码 也可以使用批处理,拷贝到新建文本里面另存为 时间修复.reg 即可
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Control Panel\International]
    "iCountry"="86"
    "iCurrDigits"="2"
    "iCurrency"="0"
    "iDate"="2"
    "iDigits"="2"
    "iLZero"="0"
    "iMeasure"="0"
    "iNegCurr"="2"
    "iTime"="1"
    "iTLZero"="1"
    "Locale"="00000804"
    "s1159"="上午"
    "s2359"="下午"
    "sCountry"="中华人民共和国"
    "sCurrency"="¥"
    "sDate"="-"
    "sDecimal"="."
    "sLanguage"="CHS"
    "sList"=","
    "sLongDate"="yyyy-MM-dd"
    "sShortDate"="yyyy-MM-dd"
    "sThousand"=","
    "sTime"=":"
    "sLongDate16"="dddd', 'MMMM' 'dd', 'yyyy"
    "iTimePrefix"="0"
    "iCentury"="0"
    "iDayLZero"="1"
    "iMonLZero"="1"
    "iChinaYear"="0"
    "iCalendar"="1"
    "sTimeFormat"="HH:mm:ss"
    "sMonDecimalSep"="."
    "sMonThousandSep"=","
    "iNegNumber"="1"
    "sNativeDigits"="0123456789"
    "NumShape"="1"
    "iCalendarType"="1"
    "iFirstDayOfWeek"="6"
    "iFirstWeekOfYear"="0"
    "sGrouping"="3;0"
    "sMonGrouping"="3;0"
    "sPositiveSign"=""
    "sNegativeSign"="-"
    
    [HKEY_CURRENT_USER\Control Panel\International\Geo]
    "Nation"="45"
    View Code

    [DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLCID")] public static extern int GetSystemDefaultLCID(); [DllImport("kernel32.dll", EntryPoint = "SetLocaleInfoA")] public static extern int SetLocaleInfo(int Locale, int LCType, string lpLCData); public const int LOCALE_SLONGDATE = 0x20; public const int LOCALE_SSHORTDATE = 0x1F; public const int LOCALE_STIME = 0x1003; public void SetDateTimeFormat() { try { int x = GetSystemDefaultLCID(); SetLocaleInfo(x, LOCALE_STIME, "HH:mm:ss"); //时间格式 SetLocaleInfo(x, LOCALE_SSHORTDATE, "yyyy-MM-dd"); //短日期格式 SetLocaleInfo(x, LOCALE_SLONGDATE, "yyyy-MM-dd"); //长日期格式 } catch (Exception ex) { Console.WriteLine(ex); } }

     

    SQL 动态添加查找条件
    if object_id('test')> 0 drop table test
     
    create table test 
    (id int primary key ,
    name nvarchar(111))
     
     
    insert test 
    select 1,'施瓦辛格'
    union all select 2,'陈道明'
     
    select * from test
     
     
    ALTER proc tSDFSDFest
    @name nvarchar(20) = null
    as
    begin
    --等于
    select * from test where name =  
    case when @name is null OR @NAME = '' then  name else @name end
    --相似
    select * from test where name LIKE 
    case when @name is null OR @NAME = '' then  name else  '%'+@name+'%' end
    end
     
     
    exec tSDFSDFest 
    exec tSDFSDFest '陈道明'
    exec tSDFSDFest '陈道'
    Top
    收藏
    关注
    评论
    作者:王思明
    出处:http://www.cnblogs.com/maanshancss/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。所有源码遵循Apache协议,使用必须添加 from maanshancss
  • 相关阅读:
    两种&
    安装版Windows是必须的
    检验CSS3.0兼容性的有趣东东
    Quadro和Geforce系列的区别
    ECMAScript
    多拉A梦的CSS(6) :not
    多拉A梦的CSS(1) Transform
    表单
    关于a元素的伪类
    多拉A梦的CSS(4) gradient
  • 原文地址:https://www.cnblogs.com/maanshancss/p/2979716.html
Copyright © 2011-2022 走看看