Really? All you have to do is set trusted=yes in the conn string, afaik. But I 
could be wrong. We only use SQL security accounts in our environment.

I'm sure it's been mentioned before but this is a good resource for connection 
strings - https://www.connectionstrings.com/sql-server/

--

rk

-----Original Message-----
From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Paul H. Tarver
Sent: Thursday, February 11, 2021 12:49 PM
To: profoxt...@leafe.com
Subject: RE: sql server connection

I do this with multiple applications and we handle it using a DSN-less 
connection. The only requirement for the pc is a 32-bit MS SQL ODBC driver must 
be installed, but no DSN needs to be created on the computer. Also, you must 
have SQL Credentials configured on the SQL Server as you cannot use Windows 
Authentication over ODBC. 

Here's a short clip of the important parts of the SQLConnect.prg I use:

        lcDSNLess = 'Driver=' + ALLTRIM(lcDriver) + ';' + ;
                'Server=' + ALLTRIM(lcServer) + ';' + ;
                'Uid=' + ALLTRIM(lcUid) + ';' + ;
                'Pwd=' + ALLTRIM(lcPWD) + ';' + ;
                'Database=' + ALLTRIM(lcDbName) 

        * Set SQL TimeOut Wait
        =SQLSETPROP(0,"ConnectTimeOut",3)

        * Suppress ODBC error dialog
        =SQLSETPROP(0,"DispWarnings",.f.)

        * Suppress login dialog 
        =SQLSETPROP(0,"DispLogin",3)

        CLEAR ERROR 
        lnConnection = SQLSTRINGCONNECT(lcDSNLess,.T.)
        lnErrorRows = AERROR(laError)

Then check to see if lnErrorRows is greater than 0 to catch any errors. 

If the lnConnection value is greater than 1, then you can start sending pass 
through commands and getting results. 

Hope that helps!

Paul H. Tarver
Tarver Program Consultants, Inc.


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/mwhpr1001mb214452ed11b3c6a571c782b0d2...@mwhpr1001mb2144.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to