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.


-----Original Message-----
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Rafael
Copquin
Sent: Thursday, February 11, 2021 6:50 AM
To: profoxt...@leafe.com
Subject: sql server connection

I have a VFP) app that uses MS sqlserver as backend. The SQL Server is
located in a web provider

The connection is achieved by creating a DSN throught the ODBC driver in my
PC

I need to deploy this app to several clients. But none of them should use
their ODBC driver to create the connection, or install the applicable SQL
Server Native Client in their PC.

The idea is that I would send them my VFP application exe and they would
simply connect to the cloud SQL Server and run the app without any further
operations to install the exe.

I tried SQLConnect and SQLStringConnect, but they always refer to an
existing DSN

Is there a way to accomplish this without my clients intervention other
than lodging the exe in the applicable directory in their PC's ??

Please advise and if possible, provide an example on how to do this

TIA

Rafael Copquin


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
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/01aa01d7009e$2a9b69e0$7fd23da0$@tpcqpc.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