Home > database >  Sqlstringconnect how to access SQL server in LAN via IP address
Sqlstringconnect how to access SQL server in LAN via IP address

Time:01-08

PUBLIC cDRVER cCOMPUTER, cSLNAME cUID, cPWD, cDATABASE, cSERVER, cTEXT8

CDRVER='SQL server'
CCOMPUTER='19.168.31.126 & amp; & SQL server IP address in local area network (LAN)
CSLNAME='HHJXCJ & amp; & The SQL instance name
CUID='zhou & amp; & SQL database user name
CPWD='000000' & amp; & SQL database password
='XTSJK' cDATABASE & amp; & SQL database
CSERVER=cCOMPUTER + '\' + cSLNAME

Wait the clear
WAIT the WINDOW system is trying to connect to the server..." "NOCLEAR NOWAIT AT SROW ()/2, SCOLS ()/2

Zcxnhandle=sqlstringconnect (" driver=& amp; CDRVER; Server=& amp; CSERVER; Uid=& amp; CUID; The PWD=& amp; CPWD ")
IF zcxnhandle<0
Wait the clear
MESSAGEBOX (" connection failed!" , 0, "tip")
The ELSE
Wait the clear
MESSAGEBOX (" successfully connect to the specified server!" , 0, "tip")
ENDIF



SQL server in 19.168.31.2 to 19.168.31.3, 19.168.31.4 19.168.31.5... 19.168.31.254 any IP address on the network segment within the client can be connected through the code above,
In short, the above code in 19.168.31. XXX network segment can normal connection,

Question: in the 19th. XXX. XXX. XXX within the segment, such as 19.123.50.26 client cannot pass the above code to connect to the SQL server 19.168.31.126

In sqlstringconnect excuse me: how to implement in the 19th. XXX, XXX, XXX network segment connection

CodePudding user response:

19.168.31. XXX for the same network segment
Possible reasons are as follows:
1, 12. XXX. XXX. XXX is not in the same network segment, DNS and went out the address of the
2, whether to the SQL server does not allow the same network segment IP access

CodePudding user response:

This is a problem of network management, has nothing to do with the VFP

CodePudding user response:

Network management have to do?

CodePudding user response:

The
reference 3 floor antony521 response:
network management have to do?
must first access to the server's network segment, secondly if there are restrictions of port have to SQL server related port open

CodePudding user response:

As long as open the firewall, port, IP is ok
  •  Tags:  
  • VFP
  • Related