VSView Reporting Edition Reference > DataSource Object > DataSource Properties > ConnectionString Property |
Sets or returns a string that specifies the data source for the report.
dataSource.ConnectionString[ = value As String ]
Use the ConnectionString property to specify a data source by passing a detailed connection string containing a series of argument = value statements separated by semicolons.
ADO supports five arguments for the ConnectionString property; any other arguments pass directly to the provider without any processing by ADO. The arguments ADO supports are as follows.
Argument |
Description |
Provider |
Specifies the name of a provider to use for the connection. |
File Name |
Specifies the name of a provider-specific file. |
Remote Provider |
Specifies the name of a provider to use when opening a client-side connection. (Remote Data Service only.) |
Remote Server |
Specifies the path name of the server to use when opening a client-side connection. (Remote Data Service only.) |
URL |
Specifies the connection string as an absolute URL identifying a resource, such as a file or directory. |
This property is identical to the ConnectionString property in the Microsoft ADO Data Control. The Reports Designer uses a "Data Link" dialog to let users create and edit the ConnectionString. The following are typical connection strings:
' ODBC connection
' NorthWind is the name of an ODBC data source
strConn = "dsn=NorthWind"
' Access file
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:\MyData\NWIND.MDB;"
' SQL Server
strConn = "Provider=SQLOLEDB.1;" & _
"Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"User ID=Bill;" & _
"Initial Catalog=Northwind;" & _
"Data Source=BILLSERVER"
NOTE: The VBScript expressions in calculated fields and event handler scripts have access to the VSReports7 object model. For security reasons, the ConnectionString property is protected and cannot be accessed through VBScript. For example, the expression "Report.DataSource.ConnectionString" returns an empty string. The reason for this is that an application may set this property using code, and assign it a connection string that contains a password. Without this protection, a malicious user could change the report definition and display the connection string on the report (including the password).
String