<ADODB_Connection>.ConnectionString

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > ADODB > ADODB Module Classes > ADODB_Connection > ADODB_Connection Properties >

<ADODB_Connection>.ConnectionString

 

Description

 
Get or Set the details used to create a connection to a data source.

 

Syntax

 

GET

s = <ADODB_Connection>.ConnectionString

 

SET

<ADODB_Connection>.ConnectionString = sConnectionString

 

Returns

 

String: current connection string.

 

Parameters

 

Name

Type

Optional

Meaning

sConnectionString

String

Yes

A string value that contains information about the connection. The string is composed of a series of parameter=value statements separated by semicolons.

 

 

Remarks

 

Restrictions

 

See also

 

A useful reference site for connection string: https://www.connectionstrings.com/

 

Examples

 

String sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & APP_SourcePath & "Biblio.mdb"

 

'---Declare a new pConnection variable

Dim pConnection As ADODB_CONNECTION

'---Instantiate it as new connection

pConnection = New ADODB_CONNECTION '[(sConn)]

'---Open indicating connection string

pConnection.Open(sConn)

 

Alternative

 

'---Declare a new pConnection variable and instantiate it in one line

Dim pConnection As New ADODB_CONNECTION '[(sConn)]

'---Set connection string

pConnection.ConnectionString = sConn

'---Open connection. Connection string is taken from ConnectionString property

pConnection.Open