private void Method1(string path) { XElement ele = XElement.Load(path); IEnumerable <XElement> eles = ele.Elements().First().Elements(); string orderNoFake = eles.Where(e => e.Name.LocalName == "copNo").First().Value; string preNo = eles.Where(e => e.Name.LocalName == "preNo").First().Value; SqlServer sql = new SqlServer(ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString); sql.ExePROCNonQuery("ToolPro", ConvertToSqlParameters(orderNoFake, preNo)); sql.CloseConnect(); }