Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Userid and Password to Connection
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00025385
Message ID:
00025514
Vues:
29
>>Using the connection designer, I can set the preference for displaying the ODBC login prompts to Always, Never, and When login information is not specified. If I select always, the login prompt appears everytime the user selects a different form (and many times for forms with more than one table).
>>
>>I would like to present the user with a form where they can enter their userid and password once, and then my application can use this information whenever it needs to connect.
>>
>>Any ideas on how this can be done?
>>
>>Jeff
>
>You can create some app object properties .connuserid, .connpassword, reset their values in your custom form, and use DBSETPROP() to set connection properties before each SQLConnect call.

Thanks for the advice! I was able to get it to work the way I wanted using DBSETPROP() with variables and macro expansion. I'm afraid I haven't figured out how to use properties in the way you described yet.

I have one more question regarding this. I am able to test wether the UserID and Password are valid by testing the connection using:

lConnHandle=SQLCONNECT("upsize")
IF lConnHandle <= 0
= MESSAGEBOX('Cannot make connection. Try entering your UserID and Password again.',;
16, 'SQL Connect Error')
ThisForm.txtUserID.SetFocus
ELSE
ThisForm.Release
ENDIF

However, if the connection is not made, before the messagebox appears I get a dialog box stating: 'Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server] Login failed.'

Is there anyway I can suppress this?

Jeff Rusch
UW-Madison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform