HOWTO: How to Disable ODBC Login Prompt at Run-Time
ID: Q187720
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a
SUMMARY
Under certain circumstances, for example when the username or password is
not correctly provided, an ODBC login prompt displays when connecting to an
ODBC datasource. This article illustrates two ways to disable the ODBC
login prompt.
MORE INFORMATION
Below are two ways to disable the login prompt when connecting to an ODBC
datasource.
Using a Named Connection
- Create/Open a database container (for example Test.dbc).
- Create a dummy connection, "conn1", and specify a datasource.
- Leave the Userid and Password fields blank.
- Select Never for "Display ODBC Login Prompt".
- Use the following code to change the Username and Password in the named
connection:
=dbsetprop("Conn1","connection","UserID","<userid>")
=dbsetprop("conn1","Connection","Password","<password>")
- Now you can use the connection to connect to an ODBC DataSource without
getting the Login prompt.
Using SQLStringConnect() or SQLConnect()
- Run the following code to set the default setting of a SQL connection:
=SQLSetProp(0,"Displogin",3)
Setting 0 (zero) as the connection handle specifies Visual FoxPro
default settings at the environment level.
- Now you can connect to the ODBC datasource using one of the following
commands, without getting the login prompt:
=SQLStringConnect('dsn=<Data Source>;uid=<User ID>;pwd=<Password>')
-or-
=SQLConnect('<Data Source>', '<User ID>', '<Password>')
Additional query words:
kbDSupport kbdse kbnokeyword
Keywords :
Version : WINDOWS:3.0,3.0b,5.0,5.0a
Platform : WINDOWS
Issue type : kbhowto
|