csharp

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);

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,442评论 19 139
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 7,946评论 0 0
  • 经验:1.在网络端接收数据后写入本地时要用write(byte[],0,len),不要用write(byte[])...
    123yuan123阅读 2,994评论 0 2
  • “初见的时候绝对不知道后来会这么喜欢你” 我想我会开始想念你,可是我刚刚才遇见了你很想和你拥有一个很长很长的未来,...
    木有昵称耶阅读 1,222评论 0 1
  • 1.在AndroidManifest文件中增加了一种叫做android:resizableActivity的属性值...
    优雨阅读 5,101评论 0 0