月度归档: 2018 年 5 月

  • SQL SERVER 获取当天数据 

    在SQL SERVER中想要获取当天数据,可以在SQL语句中添加下面的条件即可:

    where datediff(day,[Cdate],getdate())=0

    其中,Cdate是日期字段名。

  • nuget配置无效 (nuget configuration is invalid)

    nuget遇到错误:配置无效 (nuget configuration is invalid)

    解决办法:

    1. Delete the nuget.config file at %AppData%/Nuget
    2. Close the Solution and Re-Open

  • C# 执行CMD命令

    在.NET的项目开发中有时需要调用系统(Windows)命令,可以使用下面的函数来调用:

    private static string InvokeCmd(string cmdArgs)
    {
        string Tstr = "";
        Process p = new Process();
        p.StartInfo.FileName = "cmd.exe";
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardInput = true;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.RedirectStandardError = true;
        p.StartInfo.CreateNoWindow = true;
        p.Start();
        p.StandardInput.WriteLine(cmdArgs);
        p.StandardInput.WriteLine("exit");
        Tstr = p.StandardOutput.ReadToEnd();
        p.Close();
        return Tstr;
    }

    该函数经过项目测试,没有问题。

  • 装不上WIN7的解决办法

    把win7 ISO镜像解压到要安装的分区,一般是C盘

    然后执行 c:\boot\bootsect.exe /nt60 c:  建立开机引导 

    重启,从硬盘启动就行了。