标签:name set upd each pre class foreach 输出 adl
using System; using System.IO; namespace ToSql{ class ToSql{ static void Main(){ string path = System.Environment.CurrentDirectory; System.Console.WriteLine("输入要读取的文件夹名"); string name = Console.ReadLine(); path += "\\" + name; GetAllFile(path); } public static void GetAllFile(string path){ DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo[] dis = di.GetDirectories(); foreach(DirectoryInfo xdi in dis){ System.Console.WriteLine(xdi.Name); GetAllFile(xdi.FullName); } FileInfo[] files = di.GetFiles(); string sql = ""; string picurl = ""; string id = ""; foreach(FileInfo file in files){ id = (file.Name).Replace("S_","").Replace(".jpg","").Replace(".png",""); picurl = "/uploads/supplyer/" + file.Name; sql = "UPDATE `supplyer` SET picurl=‘"+ picurl +"‘ WHERE id=" + id + ";"; System.Console.WriteLine(sql); } } } }
标签:name set upd each pre class foreach 输出 adl
原文地址:http://www.cnblogs.com/gccbuaa/p/6972275.html