コード例 #1
0
ファイル: Program.cs プロジェクト: tkmallik/WeatherLogger
 public string DownloadWeatherXML()
 {
     try
     {
         string xml = new WebClient().DownloadString(_url);
         string modifiedxml = xml.Replace("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \r\n", "");
         return modifiedxml;
     }
     catch (Exception e)
     {
         LogErrors LogObj = new LogErrors();
         LogObj.InsertErrors(e.Message, e.Source, e.StackTrace, e.TargetSite.ToString());
         return null;
     }
 }
コード例 #2
0
 public string DownloadWeatherXML()
 {
     try
     {
         string xml         = new WebClient().DownloadString(_url);
         string modifiedxml = xml.Replace("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \r\n", "");
         return(modifiedxml);
     }
     catch (Exception e)
     {
         LogErrors LogObj = new LogErrors();
         LogObj.InsertErrors(e.Message, e.Source, e.StackTrace, e.TargetSite.ToString());
         return(null);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: tkmallik/WeatherLogger
 // This method calls a stored proc to insert the xml into a staging temp table
 public void InsertData(string XmlStrObj)
 {
     using (SqlConnection conn = new SqlConnection(_connstr))
         {
             try
             {
                 conn.Open();
                 SqlCommand cmd = new SqlCommand();
                 cmd.CommandText = "CheckAndInsertData";
                 cmd.CommandType = System.Data.CommandType.StoredProcedure;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@raw_xml", SqlDbType.Xml);
                 cmd.Parameters["@raw_xml"].Value = XmlStrObj;
                 cmd.Connection = conn;
                 cmd.ExecuteNonQuery();
             }
             catch (Exception e)
             {
                 LogErrors LogObj = new LogErrors();
                 LogObj.InsertErrors(e.Message, e.Source, e.StackTrace, e.TargetSite.ToString());
             }
         }
 }
コード例 #4
0
 // This method calls a stored proc to insert the xml into a staging temp table
 public void InsertData(string XmlStrObj)
 {
     using (SqlConnection conn = new SqlConnection(_connstr))
     {
         try
         {
             conn.Open();
             SqlCommand cmd = new SqlCommand();
             cmd.CommandText = "CheckAndInsertData";
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@raw_xml", SqlDbType.Xml);
             cmd.Parameters["@raw_xml"].Value = XmlStrObj;
             cmd.Connection = conn;
             cmd.ExecuteNonQuery();
         }
         catch (Exception e)
         {
             LogErrors LogObj = new LogErrors();
             LogObj.InsertErrors(e.Message, e.Source, e.StackTrace, e.TargetSite.ToString());
         }
     }
 }