dotConnect for FreshBooks Documentation
Devart.Data.FreshBooks Namespace / FreshBooksConnection Class / ConnectionString Property
Example

In This Topic
    ConnectionString Property (FreshBooksConnection)
    In This Topic
    Gets or sets the string used to open a FreshBooks connection.
    Syntax
    'Declaration
     
    Public Shadows Property ConnectionString As String
    public new string ConnectionString {get; set;}

    Property Value

    The connection string that includes the parameters needed to establish the initial connection. The default value is an empty string ("").
    Remarks
    When ConnectionString property is assigned a value, connection closes. Many of the connection string values have corresponding properties. When the connection string is set, all of these properties are updated, except when an error is detected. In this case, none of the properties are updated. FreshBooksConnection properties return only those settings contained in the ConnectionString.

    Resetting the ConnectionString on a closed connection resets all connection string values (and related properties).

    The connection string is parsed immediately after being set. If errors in syntax are found when parsing, a runtime exception, such as System.ArgumentException, is generated. Other errors can be found only when an attempt is made to Open the connection.

    The ConnectionString is similar to an OLE DB connection string. Values may be delimited by single or double quotes, (for example, name='value' or name="value"). Either single or double quotes may be used within a connection string by using the other delimiter, for example, name="value's" or name= 'value"s', but not name= 'value's' or name= ""value"". All blank characters, except those placed within a value or within quotes, are ignored. Keyword value pairs must be separated by a semicolon (;). If a semicolon is part of a value, it also must be delimited by quotes. No escape sequences are supported. The value type is irrelevant. Names are not case sensitive. Arguments names may occur only once in the connection string.

    The following table lists the valid names for values within the ConnectionString.

    Name Description
    Access Token Specifies the OAuth access token for FreshBooks. This parameter is used for connecting via Alpha API.
    API Version Determines the FreshBooks API version to use: New FreshBooks API (Alpha) or FreshBooks Classic API (Classic).
    Authentication Type Specifies the authentication method to connect to the service.
    Authentication Token Specifies the automatically generated key that is used for connecting to FreshBooks. This parameter is used for connecting via Alpha API.
    Client ID Specifies the client id, obtained from the app settings in your developer FreshBooks account. This parameter is used for connecting via Alpha API.
    Client Secret Specifies the client secret, obtained from the app settings in your developer FreshBooks account. This parameter is used for connecting via Alpha API.
    Company Name Specifies the name of the company to data of which to connect. This parameter is used for connecting via Alpha API.
    Connection Lifetime Determines the maximum time span (in seconds) a connection can remain in the pool: when a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span exceeds the value specified by Connection Lifetime. The default value is 0 (connection always returns to pool).
    Connect Timeout -or- Connection Timeout Specifies the length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. The default value is 60.
    Default Command Timeout Specifies the time in seconds to wait while trying to execute a command before terminating the attempt and generating an error. A value of 0 indicates no limit.
    Failover Retries Specifies the maximum number of retry attempts to reconnect after a failover event.
    FreshBooks Time Zone Specifies the time zone used when processing FreshBooks date and time values.
    Include Deleted Determines whether to include deleted records to returned data. Not all FreshBooks objects support returning of deleted records.
    Initialization Command Specifies a data source-specific command to execute immediately after the connection is established.
    Local SQL Engine Uses a local SQL engine to process queries instead of a remote server.
    Max Pool Size Specifies the maximum number of connections allowed in the pool. Setting the Max Pool Size value of the ConnectionString can affect performance. The default value is 100.
    Min Pool Size Specifies the minimum number of connections allowed in the pool. The default value is 0.
    NormalizeDbNames Determines whether database object names are normalized when retrieved from the database.
    OAuth Storage Specifies the path to a file, where to store FreshBooks Access and Refresh Token between sessions in order to avoid the need to re-authorize the application. This parameter is used for connecting via Alpha API.
    Persist Security Info Indicates if security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.
    Pooling Determines whether, by default, the FreshBooksConnection object is drawn from the appropriate pool or is created and added to the appropriate pool, when set to true.
    Proxy Host Specifies the host name or IP address of proxy server.
    Proxy Password Specifies the password for the proxy server account.
    Proxy Port Specifies the port number of the proxy server. The default value is 3128.
    Proxy User Specifies the proxy server account name.
    Run Once Command Specifies a command to execute the first time the connection is opened. The command is not executed when the connection is retrieved from the connection pool.
    Readonly Determines whether the connection is read-only (allows only SELECT statements).
    Refresh Token Specifies an automatically generated key that is used for refreshing the authentication token when it expires. Note that a new refresh token is generated and assigned automatically every time when the authentication token is refreshed. This parameter is used for connecting via Alpha API.
    Server Specifies the FreshBooks service account URL, for example "newcompany1111.freshbooks.com".
    Token Server Specifies the location where OAuth 2.0 refresh tokens are stored between sessions. The location can be a file on disk or a registry key.
    UTC Dates Indicates whether all the datetime values retrieved from the data source are returned as UTC values or converted to local time, and whether date values, specified on the application side (for example, in SQL statements) are considered UTC or local. Default value is false.
    Example
    The following example creates a FreshBooksConnection and sets some of its properties in the connection string.
    public void CreateFreshBooksConnection()
    {
      string myConnString1 = 
         "API Version=Alpha;Access Token=3d3355b2beea67f9241400fbe28f0b116e3efd2f8a85dda3c35620acdc95cd60;Refresh Token=75836f50da63fc5bf81bb24598511ae131ea422e73d9f321b4c4a44e2dd1c67f;Company Name=Devart";
      FreshBooksConnection freshbooksConnection1 = new FreshBooksConnection(myConnString1);
      freshbooksConnection1.Open();
    }
    Public Sub CreateFreshBooksConnection()
      Dim myConnString1 As String = _
          "API Version=Alpha;Access Token=3d3355b2beea67f9241400fbe28f0b116e3efd2f8a85dda3c35620acdc95cd60;Refresh Token=75836f50da63fc5bf81bb24598511ae131ea422e73d9f321b4c4a44e2dd1c67f;Company Name=Devart"
      Dim freshbooksConnection1 As New FreshBooksConnection(myConnString1)
      freshbooksConnection1.Open()
    End Sub
    See Also