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

Read a file on a different server

Status
Not open for further replies.

donishere

Programmer
May 7, 2002
101
I am trying to read a file that is on another server on my internal network. Does anyone know the code on how to do this?

Thanks,
don
 
Set Conn1 = Server.CreateObject("ADODB.Connection")
Set Conn2 = Server.CreateObject("ADODB.Connection")

Conn1.Provider = ("sqloledb")
Conn2.Provider = ("sqloledb")

Conn1.Open "Database=Master;uid=Me;pwd=1234"
Conn2.Open "Server=AnotherServer;Database=Master;uid=me;pwd=1234"

As long as your in the same domain, this should do the trick.
 
you could also use the FSO object

fso_OpenTextFile in example.

you just have to specify the path like you would do on the network and have your IIS permission on the other computer to do want you want with the file.
 
Dear doishire
here is the code to do with the textfile at the place of ur netework ,you should have persmission to access the folder where the file present
Hope it will help you
Regards
Nouman
Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("\\yourserver\path\filename.txt", ForAppending,TristateFalse)
f.Write "Hello world!"
f.Close
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top