csharp

作者: Java初级攻城狮 | 来源:发表于2018-03-30 15:32 被阅读0次

    DataBase butt joint:
    if(DataBase.Exists)
    {
    come on!
    Attention :localhost、port、DataBasename 、username、password
    picture path
    }
    if(!DataBase.Exists)
    {
    first: to find DataBase server exists visual tool connection DB( find username password through xml)
    second: butt joint
    }
    if(!table.fields.Exists)
    {
    find view select * from viewname
    }
    DataBaseResotre:SQL Server Restore:
    mdf文件 附加进行还原
    将mdf文件以及log.mdf日志文件全部拷贝到SQL Server数据库的安装目录下
    的DATA文件夹下,然后进行找到该目录 找到mdf文件 进行还原

    Download files from ftp:
    WebClient wc = new WebClient();
    wc.Headers.add("User_Agent","Chrome");
    wc.credentials = new NetworkCredential("username", "password");
    wc.DownloadFile("ftp://10.4.8.202:26/download.txt","c://download1.txt");

    Download picture from Internet:
    Core code:(WebClient function is visit url)
    WebClient wc = new WebClient();
    wc.Headers.add("User_Agent","Chrome");
    wc.downloadFile("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1521534886900&di=80d30358851dd53dcebb152fc76291ca&imgtype=0&src=http%3A%2F%2Fupload.news.cecb2b.com%2F2016%2F0327%2F1459067610166.jpg", @"D:\ftp\image3.gif");

    IoStreamFile/Folder:
    Folder:
    string path = @"c:\MyDir";
    Directory.CreateDirectory(path);
    File(create file and write):
    string path = @"c:\MyDir\file1.txt";
    FileStream fr = new FileSteam(path,FileMode.CreateNew);
    StreamWrite sw = new StreamWrite(fr);
    sw.write("This is write to path");
    File(read):
    string line ;
    StringReader sr = new StringReader(path);
    while(line = sr.Reader() != null)
    {
    Console.WriterLine(line.toString()); }

    Csharp中解决生成多个随机数重复问题:
    int randnew = new Random(Guid.NewGuid().GetHashCode()).Next(0, 10);

    相关文章

      网友评论

        本文标题:csharp

        本文链接:https://www.haomeiwen.com/subject/nvsicftx.html