void Main() { string dirp=@"E:\Cread\UP4201308.bak\UP4.BAK\ExportPath\ConfigFile\"; DirectoryInfo mydir = new DirectoryInfo(dirp); foreach (FileSystemInfo fsi in mydir.GetFileSystemInfos()) { if(fsi.Extension.ToLower()==".xml") { ("--"+ fsi.FullName).Dump(); try { Write(fsi.FullName); } catch(Exception ex) {} } } //string pFileName = @"E:\Cread\UP4201308.bak\UP4.BAK\ExportPath\ConfigFile\AbsentDays.xml"; //Write(pFileName); } void Write(string pFileName) { string content=System.IO.File.ReadAllText(pFileName); XElement config = XElement.Parse (content); string tableName =config.Element ("TableName").Value; string columnName =""; string description =""; ("--"+tableName).Dump(); XElement client = config.Element ("Columns"); string sqltemp="EXECUTE sp_addextendedproperty N'MS_Description', N'{2}', N'user', N'dbo', N'table', N'{0}', N'column', N'{1}'"; for(int i = 0;i<client.Elements("Column").Count();i++) { columnName = client.Elements("Column").ElementAt(i).Attribute("Name").Value.ToString(); description = client.Elements("Column").ElementAt(i).Attribute("Description").Value.ToString(); string sql=string.Format(sqltemp,tableName,columnName,description).Dump(); } }
// Define other methods and classes here