Make sure you are using ODBC Data Sources (32-bit) and in the Drivers tab
you'll see which drivers you have for SQL.
I have ODBC Driver 17 for SQL Server, SQL Server and SQL Server Native
Client 11.0
I prefer to use a connection string rather than DSN so that I don't have to
set up a DSN on each client.

m.lcDriver    = "SQL Server"
m.lcSQLServer = "SQL2016DEV"
m.lcDatabase  = "AdventureWorks"

m.lcConnStr =
TextMerge("Driver={<<m.lcDriver>>};Server=<<lcSQLServer>>;Database=<<m.lcDatabase>>;Trusted_Connection=Yes;")

SQLSetProp(0, "ConnectTimeOut", 3)  && seconds to timeout
SQLSetProp(0, "DispLogin", 3)       && 3 = do not display login

m.lhSql = SQLStringConnect(m.lcConnStr)
If m.lhSql < 0
   MessageBox(Message())
   Return
EndIf

If SQLExec(m.lhSql, "select * from Sales.Customer", "customers") < 0
   MessageBox(Message())
Else
   Browse Normal
EndIf

If m.lhSql > 0
   SQLDisconnect(m.lhSql)
EndIf


Make sure you always check the result of SQLExec or it will just silently
fail.

Ricardo

On Tue, 20 Aug 2019 at 17:27, Peter Cushing <pcush...@whisperingsmith.com>
wrote:

> Hi,
>
> Thanks to everyone that replied.  I don't have to worry about getting
> fired, so all good there.
> SPT seems the easiest to begin with, but not got it working yet.
> I have created an ODBC link called X2live.  I set it up as a system DSN
> as I tried a user DSN first and that didn't work.
> Just wondering what version of the ODBC driver are you using.  Mine is:
> Microsoft SQL Server ODBC Driver Version 06.01.7601
> Did a few quick searches and can't seem to establish if this is a 32 or
> 64 bit driver.
>
> When I click test data source it comes back with Tests completed
> successfully but if I try
> ?sqlconnect('x2live')       && returns -1
>
> I have tried putting in the username/password and didn't make any
> difference.
>
> What actual commands do you use to connect?
>
> TIA
>
> Peter Cushing
> IT Department
> WHISPERING SMITH
>
>


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

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/CAJeZx3=NU74Ma-kMR3xLBHBk_oP4gjP0x=f+k98nghrd4dp...@mail.gmail.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