SQLCONNECT and the ODBC Pop-Up Login Dialog Box 
Author Message
 SQLCONNECT and the ODBC Pop-Up Login Dialog Box

I have a problem.

I issue the following statement:

nConnectionHandle = SQLCONNECT( "ODBCDataSourceName", ;
                                "usercode", ;
                                "password" )

If the database is down, the usercode and password is
incorrect, rights, who knows, if there is something wrong,
the ODBC Dialog Box pops up and asks for your usercode and
password again using the system ODBC dialog box.  So the
question is, how do I surpress this?

BEFORE YOU ANSWER!!!

1) I am NOT using a database container at ALL!!!  All my
code is SQL Pass Thru (SQLEXEC).  So FORGET about using
DBSETPROP.

2) Don't tell me to use SQLSETPROP, because in order to
execute the following:

SQLSETPROP( nConnectionHandle, "DispLogin", 3 )

I need the nConnectionHandle, and in order to get that, I
need to execute this statement:

nConnectionHandle = SQLCONNECT( "ODBCDataSourceName", ;
                                "usercode", ;
                                "password" )

WHAT!!! HUH!!!  As soon as I do this, the damn ODBC dialog
will appear.  It is a little bit too late!!!  I never get
the chance to run it!!!

RESEARCH

I know it can be done.  Running from within FoxPro, you
can go to tools, options, remote data tab, on the bottom -
Show login: and set it to Never.  The default is "Only
When Necessary".  So the real question is, "How can I set
this global default value within my compiled
application?"  I also check FOXUSER.DBF and the registry
to no avail.  HELP!!!!!



Tue, 23 Aug 2005 06:31:40 GMT  
 SQLCONNECT and the ODBC Pop-Up Login Dialog Box
FURTHER RESEARCH:

Within the Registry:

NKEY_CURRENT_USER
  Software
    Microsoft
      VisualFoxPro
        7.0
          Options
          (and one of the properties is SQLDispLogin)

            SQLDispLogin = 1 (Only When Necessary)

This is the where the DEFAULT settings are stored.

If you change it in the tools / options / etc. for the
current foxpro session, and do not hit the "Save As
Default", this value does not change.  

In addition, if you go into the registry and change the
SQLDispLogin from 1 to 3 (Never) while FoxPro is going, it
does nothing to the current session of FoxPro.  Only once
you close and open FoxPro does it read the defaults and
continue.

Soooo....  How can you change this environment setting
while within FoxPro w/o going through tools / options AND
how do you do it with a new executable?



Tue, 23 Aug 2005 07:07:25 GMT  
 SQLCONNECT and the ODBC Pop-Up Login Dialog Box
Well, it is documented, I just didn't see or read into it:

Remarks:

Use SQLSETPROP() to specify settings at the connection
level.  To specify Visual FoxPro default settings at the
environment level, include 0 as the connection handle.

Therefore, the answer it:

SQLSETPROP( 0, "DispLogin", DB_PROMPTNEVER )

Thanks for listening...



Tue, 23 Aug 2005 07:13:32 GMT  
 SQLCONNECT and the ODBC Pop-Up Login Dialog Box
thanks for posting your answer... i tried to figure out the solution and
gave up!


Quote:
> Well, it is documented, I just didn't see or read into it:

> Remarks:

> Use SQLSETPROP() to specify settings at the connection
> level.  To specify Visual FoxPro default settings at the
> environment level, include 0 as the connection handle.

> Therefore, the answer it:

> SQLSETPROP( 0, "DispLogin", DB_PROMPTNEVER )

> Thanks for listening...



Tue, 23 Aug 2005 08:03:58 GMT  
 SQLCONNECT and the ODBC Pop-Up Login Dialog Box
How about using a view just to get a handle witrh
CursorGetProp('connecthandle')
-Anders


Quote:
> I have a problem.

> I issue the following statement:

> nConnectionHandle = SQLCONNECT( "ODBCDataSourceName", ;
>                                 "usercode", ;
>                                 "password" )

> If the database is down, the usercode and password is
> incorrect, rights, who knows, if there is something wrong,
> the ODBC Dialog Box pops up and asks for your usercode and
> password again using the system ODBC dialog box.  So the
> question is, how do I surpress this?

> BEFORE YOU ANSWER!!!

> 1) I am NOT using a database container at ALL!!!  All my
> code is SQL Pass Thru (SQLEXEC).  So FORGET about using
> DBSETPROP.

> 2) Don't tell me to use SQLSETPROP, because in order to
> execute the following:

> SQLSETPROP( nConnectionHandle, "DispLogin", 3 )

> I need the nConnectionHandle, and in order to get that, I
> need to execute this statement:

> nConnectionHandle = SQLCONNECT( "ODBCDataSourceName", ;
>                                 "usercode", ;
>                                 "password" )

> WHAT!!! HUH!!!  As soon as I do this, the damn ODBC dialog
> will appear.  It is a little bit too late!!!  I never get
> the chance to run it!!!

> RESEARCH

> I know it can be done.  Running from within FoxPro, you
> can go to tools, options, remote data tab, on the bottom -
> Show login: and set it to Never.  The default is "Only
> When Necessary".  So the real question is, "How can I set
> this global default value within my compiled
> application?"  I also check FOXUSER.DBF and the registry
> to no avail.  HELP!!!!!



Tue, 23 Aug 2005 20:35:20 GMT  
 SQLCONNECT and the ODBC Pop-Up Login Dialog Box
That would assume he already had a connection.  The
problem he was having was getting the connection handle.

And if you are assuming he was using a remote view
(through the database container), you would have read in
the first message he doesn't use database containers.

What his problem was using nothing but SQLCONNECT and
surpressing the dialog box which he answered his own
question above.  I am glad someone answered this question
because I didn't know myself...

Quote:
>-----Original Message-----
>How about using a view just to get a handle witrh
>CursorGetProp('connecthandle')
>-Anders



Tue, 23 Aug 2005 23:25:19 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. SQLConnect brings up SQL Server Login Dialog

2. Preventing ODBC Login Box Question

3. Pop Ups with Icons

4. Prevent display of SQL login dialog

5. Open file dialog pops up when run a report

6. How to popup OpenFile Dialog window ?

7. ODBC Login prompts (wont go away!)

8. How to Connect VFP 6 to ORACLE-ODBC without ORALE-LogIn-Window

9. ODBC FoxPro Driver Login Failed

10. Suppressing ODBC Login

11. odbc login

12. White spot on form after dialog boxes.

 

 
Powered by phpBB® Forum Software