Class ExternalConnectionCollection
Represents a collection of external data connections in a workbook.
Inherited Members
Namespace: DRIT.Spreadsheet.Data
Assembly: DRIT.Spreadsheet.dll
Syntax
public class ExternalConnectionCollection : IEnumerable<DataConnection>, IEnumerable
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
Properties
Count
Gets the number of external connections.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
this[int]
Gets the data connection at the specified index.
Declaration
public DataConnection this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Property Value
| Type | Description |
|---|---|
| DataConnection |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
this[string]
Gets the data connection with the specified name.
Declaration
public DataConnection this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Property Value
| Type | Description |
|---|---|
| DataConnection |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
Methods
Add(DataConnection)
Adds a data connection to the workbook.
Declaration
public DataConnection Add(DataConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| DataConnection | connection |
Returns
| Type | Description |
|---|---|
| DataConnection |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
AddDatabase(string, string, string)
Adds a new database connection with the specified connection string and command text.
Declaration
public DatabaseConnection AddDatabase(string name, string connectionString, string commandText)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| string | connectionString | |
| string | commandText |
Returns
| Type | Description |
|---|---|
| DatabaseConnection |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
AddWebQuery(string, string)
Adds a new web query connection with the specified URL.
Declaration
public WebQueryConnection AddWebQuery(string name, string url)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| string | url |
Returns
| Type | Description |
|---|---|
| WebQueryConnection |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<DataConnection> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<DataConnection> |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.
Remove(DataConnection)
Removes the specified data connection from the workbook.
Declaration
public bool Remove(DataConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| DataConnection | connection |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
This collection wraps the workbook's Connections list with typed accessors for DatabaseConnection, WebQueryConnection, OlapConnection, and TextConnection connections.