System.Data.DataTableCollection.Add C# (CSharp) Méthode

Add() public méthode

Adds the specified table to the collection.
public Add ( DataTable table ) : void
table DataTable
Résultat void
        public void Add(DataTable table)
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataTableCollection.Add|API> {0}, table={1}", ObjectID, (table != null) ? table.ObjectID : 0);
            try
            {
                OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
                BaseAdd(table);
                ArrayAdd(table);

                if (table.SetLocaleValue(_dataSet.Locale, false, false) ||
                    table.SetCaseSensitiveValue(_dataSet.CaseSensitive, false, false))
                {
                    table.ResetIndexes();
                }
                OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }

Same methods

DataTableCollection::Add ( ) : DataTable
DataTableCollection::Add ( string name ) : DataTable
DataTableCollection::Add ( string name, string tableNamespace ) : DataTable

Usage Example

		public void WriteXmlSchema (XmlWriter writer)
		{
			DataSet ds = DataSet;
			DataSet tmp = null;
			try {
				if (ds == null) {
					tmp = ds = new DataSet ();
					ds.Tables.Add (this);
				}
				DataTableCollection col = new DataTableCollection (ds);
				col.Add (this);
				XmlSchemaWriter.WriteXmlSchema (ds, writer, col, null);
			} finally {
				if (tmp != null)
					ds.Tables.Remove (this);
			}
		}
All Usage Examples Of System.Data.DataTableCollection::Add