For Programmers: Free Programming Magazines  


Home > Archive > Visual FoxPro Programming > June 2006 > Help! ODBC Connection failing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help! ODBC Connection failing
LuvPoker

2006-06-17, 8:49 am

I've posted this question a few times with no luck. This issue has not
escalated to the point where my company is considering forcing me to change
out of VFP in to VB. YUCK!! Please take a moment and see if you can help.

The problem is I can't seem to trap the ODBC "Connection Failed" error when
it fails to connect. I must create/use the connection in code. I currently
use the following syntax:

Create Connection MyCon;
datasource SystemDSN;
userid UserName;
password Password

I subsequently use that connection creating/using remote views in code. If
I understand correctly the failure is happening when I use the connection
not when I create it right? But as I understand it I could use a connection
string in VFP to create this connection instead of the above. I can't seem
to find a good example and what all options are available for a SQL
connection string.

I am told by the guy who is pushing hard to get me to switch to VB that I
can simply turn the ODBC dialogue off using this code in VB:

Set M_cn = rdoEnvironments(0).OpenConnection("", rdDriverNoPrompt, False,
"DSN=" & Sdsn & ";UID=" & SDsnUser & ";PWD=" & sDsnPass)

The simplest solution I thiink would be to suppress any ODBC dialogue. The
ideal solution would be to somehow test for a success/fail when I try and
use it and try again if it fails.

Please help.

- Ben




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com