try { cmdUpdateComm = new SqlCommand(); cmdUpdateComm.Connection = conn; cmdUpdateComm.CommandText = "web_UpdateHistCommSp"; cmdUpdateComm.CommandType = CommandType.StoredProcedure; cmdUpdateComm.CommandTimeout = 30; aParam = new SqlParameter(); aParam.ParameterName = "@ManID"; aParam.SqlDbType = SqlDbType.VarChar; aParam.Size = 17; aParam.Direction = ParameterDirection.Input; cmdUpdateComm.Parameters.Add(aParam); cmdUpdateComm.Parameters["@ManID"].Value = macAddr; cmdUpdateComm.ExecuteNonQuery(); cmdUpdateComm = null; } catch (Exception ex) { writeError("SP: " + ex.Message); } finally { cmdUpdateComm = null; } int tzOffset = 0; if (!(int.TryParse(root.Attributes.GetNamedItem("TZOffset").Value, out tzOffset))) { writeError("Invalid TZOffset: " + root.Attributes.GetNamedItem("TZOffset").Value); return; } bool bDST = root.Attributes.GetNamedItem("DST").Value.Equals("1"); bool bCalcDelta = WebConfigurationManager.AppSettings["CalcDelta"].Equals("Y"); DateTime TimeStamp = DateTime.MinValue; string sensorId = ""; int sensorType = 0; int pIndex = 0; string nodeVal = ""; decimal dValueA = 0; decimal dValueB = 0; string sState = ""; decimal dHumidity = 0; decimal dTemp = 0; decimal dAnalog = 0; string sSourceIp = Request.ServerVariables.Get("REMOTE_HOST"); for (int i1 = 0; i1 < root.ChildNodes.Count; ++i1) { XmlNode xmlPNode = root.ChildNodes.Item(i1); for (int i2 = 0; i2 < xmlPNode.ChildNodes.Count; ++i2) { bool EmptyRecord = false; XmlNode xmlNode = xmlPNode.ChildNodes.Item(i2); string nodeName = xmlNode.Name; string nodeText = xmlNode.InnerText; switch (nodeName)