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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLEDB error connect to remote server

Status
Not open for further replies.

freddiekg

Programmer
Oct 13, 2009
25
MY
In have problem connecting a DBC in a remote server via IP address. Please help.

Thanks in advance!

cConnectString = [Provider=VFPOLEDB.1;Data Source=] + [\\110.6.33.110\fos\data\fostest.dbc;] + ;
[Mode=ReadWrite|Share Deny None;User ID="Administrator";Password="xxx";Collating Sequence=MACHINE]
oConn = CreateObject("ADODB.Connection")
oConn.ConnectionString = cConnectString
oConn.ConnectionTimeout = 30
oConn.Open
cSQL = "select * from cssinfo"
oRS = oConn.Execute (cSQL)
if oRS.EOF
? "No records found."
oRS.Close
oConn.CLose
RELEASE oRS, oConn
RETURN
endif

do while !oRS.EOF
? oRS.Fields("css_no").Value + " - " + ;
oRS.Fields("css_userenter").Value
oRS.MoveNext
enddo

oRS.Close
oConn.CLose
RELEASE oRS, oConn
 
Right off the bat, that connection seems to be to a share on a remote machine - addressed by IP.

My connection strings tend to refer to a virtual folder set up on the server in advance, so all the permissions etc can be established and tested.

Code:
cConnectString = [Provider=VFPOLEDB.1;Data Source=] +  [myVirtualDirectory\fostest.dbc;] + ;
  [Mode=ReadWrite|Share Deny None;User ID="Administrator";Password="xxx";Collating Sequence=MACHINE]
oConn = CreateObject("ADODB.Connection")
oConn.ConnectionString = cConnectString
oConn.ConnectionTimeout = 30
oConn.Open
cSQL = "select * from cssinfo"
oRS = oConn.Execute (cSQL)
if oRS.EOF
   ? "No records found."
   oRS.Close
   oConn.CLose
   RELEASE oRS, oConn
   RETURN
endif



Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top