Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correct coding for TRY...CATCH?
Message
From
27/09/2007 14:50:26
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Correct coding for TRY...CATCH?
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000 SP4
Database:
MS SQL Server
Miscellaneous
Thread ID:
01257295
Message ID:
01257295
Views:
62
Hi All,

I am trying to do a Try...Catch, like this:
    gocnn     = CREATEOBJECT('adodb.connection')
    lconStr  = "Provider=SQLOLEDB;Data Source=" + lcserver + ";Initial Catalog=" + lcdb + ;
               ";Integrated Security=SSPI;Persist Security Info=False"
    TRY
      gocnn.Open(lconstr)
    CATCH
      lconStr = "Provider=sqloledb; Server=" + lcserver + ;
           ";Database=" + lcdb + ";User Id=" + lcuser + ;
           ";Password=" + lcpwd
      gocnn.Open(lconstr)    <<---------------Error here, I think
    ENDTRY
    gocnn.commandtimeout = 1000
But I am getting an unstructured Error ( not correct wording) on the line indicated. This is my first time trying this error catching method and want to be sure it is not something stupid, yet.

We need to be able to avoid getting an error thrown to the user, prompting them to enter their user name and password if the machine they remote desk topped into does not have a trusted connection with the sql server.

TIA
Beth
Next
Reply
Map
View

Click here to load this message in the networking platform