System.Data.DataSet.GetXml C# (CSharp) Method

GetXml() public method

public GetXml ( ) : string
return string
        public string GetXml()
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataSet.GetXml|API> {0}", ObjectID);
            try
            {
                // StringBuilder strBuilder = new StringBuilder(EstimatedXmlStringSize());
                // StringWriter strWriter = new StringWriter(strBuilder);
                StringWriter strWriter = new StringWriter(CultureInfo.InvariantCulture);
                if (strWriter != null)
                {
                    XmlTextWriter w = new XmlTextWriter(strWriter);
                    w.Formatting = Formatting.Indented;
                    new XmlDataTreeWriter(this).Save(w, false);
                }
                return strWriter.ToString();
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }

Usage Example

Beispiel #1
0
        protected string getCountryInXml()
        {
            dbManager = new DBConnection();

            try
            {
                SqlCommand command = new SqlCommand();

                command.Connection = dbManager.Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "[dbo].[get_country_list]";

                XmlReader reader = command.ExecuteXmlReader();

                DataSet ds = new DataSet();
                ds.ReadXml(reader);

                return ds.GetXml();
            }

            finally
            {
                dbManager.Close();
            }
        }
All Usage Examples Of System.Data.DataSet::GetXml