Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing remote server

Status
Not open for further replies.

jayfox

Programmer
Dec 19, 2002
29
0
0
US
I access a remote server with pcanywhere in which sql server resides on that server. I just loaded vis fox on my machine how can I access sql server on the remote machine?
 
jayfox

You can use an ODBC driver (appropriate to your SQL server). Here is a sample code I use for a MYSql server.
Code:
lcServer = 'Ppaid'
lcDatabase = "Activity"
lcUser = 'user'
lcPassWord = 'uwt'
GetConnHandle = SQLCONNECT(lcServer,lcUser,lcPassWord)
IF GetConnHandle > 0
   = SQLPREPARE(GetConnHandle, 'Select * from cards where nActive= "1"')
   GetQuery  = SQLEXEC(GetConnHandle)
   IF GetQuery> 0
      SELECT SqlResult
      COUNT TO lnActiveCards
   ENDIF
   = SQLPREPARE(GetConnHandle, 'Select * from cards where nActive= "0"')
   GetQuery  = SQLEXEC(GetConnHandle)
   IF GetQuery> 0
      SELECT SqlResult
      COUNT TO lnExpiredCards
   ENDIF
   SQLDISCONNECT(GetConnHandle) && Close the ODBC connection
ENDIF

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I think the question you're asking is how to access SQL Server on a pcAnywhere host using VFP on a pcAnywhere remote. I haven't used pcAnywhere for a few months, but I think the answer is, you can't. pcAnywhere isn't network software, it's remote control software. When you connect to the pcaw host, you become that machine. Your machine is invisible - all your keystrokes are executed on the host machine.

So to do what you want, load VFP on the pcaw host machine to which you are connecting, then use Mike's method to connect to the SQL server "on the local machine", which is the pcaw host.

Mike Krausnick
Dublin, California
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top