public static YellowstonePathology.Business.Domain.XElementFromSql GetXmlOrdersToAcknowledge(string panelOrderIds) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "pGetXmlOrdersToAcknowledge_A1"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@PanelOrderIdString", SqlDbType.VarChar).Value = panelOrderIds; XElement fromSqlElement = new XElement("Document"); using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (XmlReader xmlReader = cmd.ExecuteXmlReader()) { if (xmlReader.Read() == true) { fromSqlElement = XElement.Load(xmlReader); } } } YellowstonePathology.Business.Domain.XElementFromSql xElementFromSql = new Domain.XElementFromSql(); xElementFromSql.Document = fromSqlElement; return xElementFromSql; }