Microsoft KB Archive/187720

= HOWTO: How to Disable ODBC Login Prompt at Run-Time =

Article ID: 187720

Article Last Modified on 3/3/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Data Access Components 2.5

-



This article was previously published under Q187720



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"," ") =dbsetprop("conn1","Connection","Password"," ")  Now you can use the connection to connect to an ODBC DataSource without getting the Login prompt.</ol>

Using SQLStringConnect or SQLConnect
<ol>  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. </li>  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>') </li></ol>

Additional query words: kbdse

Keywords: kbhowto KB187720

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.