PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 21 → WD21 : How to connect with MS SQL database over the network?
WD21 : How to connect with MS SQL database over the network?
Débuté par Joris, 16 mai 2017 15:49 - 4 réponses
//hostimage.webdev.info/avatars/default.gif
Posté le 16 mai 2017 - 15:49
Hi,

I need to make a connection with an SQL database to load some data from another software into our Windev application (that is using Hyperfile).
I managed to do this by using the SQLConnect() command, SQLFirst(), SQLNext() etc...
This is working fine on the server (where the SQL database is located) but not on workstations.

I'm using this command :

MyConnection is int = SQLConnect("SBS2011\PFD","MyLogin","MyPassword","PFD","OLEDB",hOledbSQLServer)
SQL Server 2008 R2
SBS2011 is the name of the server
PFD is the name of the database

Many thanks,

Joris
//hostimage.webdev.info/avatars/default.gif
Posté le 16 mai 2017 - 16:08
Hi Joris,

I'ld use oleDB for SQL Server in this case instead of ODBC...
You'll make your life a lot easier.

Cheers,

Peter Holemans
//hostimage.webdev.info/avatars/z5okK3D0Uxf0oEkH6ZlAg
Membre enregistré
214 messages
Posté le 16 mai 2017 - 16:38
Hi Joris,

is 1433 port open on your SBS2011 ??

--
Christophe Charron
//hostimage.webdev.info/avatars/default.gif
Posté le 16 mai 2017 - 16:45
John,
- In SQL server manager allow remote connections
- In SQL configuration manager allow the tcp-ip protocol instead of pipes
- SQL express uses dynamic ports. Google for configure firewall mssql express.

Succes

Walter
//hostimage.webdev.info/avatars/default.gif
Posté le 18 mai 2017 - 15:30
I could connect to any MS Sql Server in my network with the following connection parameters.

DataBaseConnection is Connection

DataBaseConnection..Provider = hOledbSQLServer
DataBaseConnection..User = INIRead("Database","LogId", "", "INI FileName")
DataBaseConnection..Password = INIRead("Database", "Logpassword","", "INI FileName")
DataBaseConnection..Server = INIRead("Database", "ServerName","", "INI FileName")
DataBaseConnection..Database = INIRead("Database", "Database", "", "INI FileName")
//DataBaseConnection..Access = hORead

IF HOpenConnection(DataBaseConnection) = False THEN
Info(HErrorInfo)
EndProgram(False)
END

IF HChangeConnection("*", DataBaseConnection) = False THEN
Info(HErrorInfo)
EndProgram(False)
END

Hope by having relevant data in the ini file, you could also connect.

Happiness Always
BKR Sivaprakash