HOWTO: Invoke a Login Prompt when Opening an ADO ConnectionID: Q200886
|
This article describes how to control a Data Provider's Login prompt.
To control a Data Provider's login prompt set the "Prompt" property exposed through the Properties collection of the Connection object to one of the four pre-defined constants or values as follows:
adPromptAlways = 1
adPromptComplete = 2
adPromptCompleteRequired = 3
adPromptNever = 4
The constants specify whether to always prompt, prompt if more information is needed, prompt if more information is needed but optional parameters are not allowed, or never prompt.
Dim cn as ADODB.Connection
Set cn = New ADODB.Connection
With cn
.Properties("Prompt") = adPromptAlways
.Open
End With
In Example 1, when the Open method is called, the ODBC Login prompt appears every time regardless of what the ConnectionString property may hold.
Dim cn as ADODB.Connection
Set cn = New ADODB.Connection
With cn
.Provider = "SQLOLEDB"
.Properties("Prompt") = adPromptComplete
.ConnectionString = "DATA SOURCE=<server name>;"
.Open
End With
In Example 2, the Provider property is set to "SQLOLEDB", so the OLE DB Provider for SQL Server Prompt is presented to the user instead of the ODBC Login Prompt.
For more information, please see the following article in the Microsoft Knowledge Base:
Q193128 HOWTO: ODBC and OLEDB Connection Prompt Control in ADO(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Matthew Hofacker, Microsoft Corporation.
Additional query words: kbDSupport
Keywords : kbADO kbADO150 kbADO200 kbADO201 kbADO210 kbOLEDB kbGrpVBDB
Version : WINDOWS:1.5,2.0,2.01,2.1
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 13, 1999