CreateConnection()
- Last UpdatedNov 25, 2015
- 1 minute read
Use the CreateConnection() method to request a connection to a SQL Server data source.
Syntax
aaDBConnection.CreateConnection(
string ConnectionString)
Parameters
ConnectionString
A previously formatted connection string or a reference to an attribute in any ArchestrA object.
Remarks
The CreateConnection() method returns a connection object to be used for subsequent SQL requests. Each call to CreateConnection() returns a unique and different connection object. Each connection object represents a separate connection that uses the same connection string. This method is best used to provide different connections for different purposes. For example, when one connection is used to query and another is used to update the database.
You can check the status of a connection by using the ConnectionState read-only property.
Example
The following example shows a connection string for use with SQL Server. The connection string can also be stored in an attribute in an Archestra object:
me.ExampleConnectionString