VB6 codes for spreading data on office network

Asked By 10 points N/A Posted on -
qa-featured

Hi everybody

I want to spread my data through my office network. I want to do this without specifying any location. And it should detect all possible computers in my network. I know vb6 can do that but i need to know the code. Can anyone help me by providing spread network vb6 code. By which i can spread my data all over my network. If anyone can I would be grateful.

SHARE
Best Answer by Alice R Jones
Answered By 0 points N/A #159245

VB6 codes for spreading data on office network

qa-featured

 

Hi,
As far as I know, it is required to specify the location. This code works well if you have specified the location 
Dim cnn As New ADODB.Connection 
Dim Str As String 
 Set cnn = New ADODB.Connection 
Str = "\Computernamefoldernamedatabase 
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Str + ";Persist Security Info=False" 
cnn.CursorLocation = adUseClient
 
Regards,
Laz Zebbena
Best Answer
Best Answer
Answered By 0 points N/A #159246

VB6 codes for spreading data on office network

qa-featured

If you want to copy a file/folders to all the share location on your network the following code should work:-

 

Sub fsoCopyFile(byval strSource as string,byval StrDest As string)

dim fso as new Scripting.FilesystemObject

Fso.copyFile StrSource,StrDest

end sub

 

' To call This Procedure
' fsocopyFile("D:abc.txt","\servernameSharenameabc.txt")

 

If in case the destination folder is passwords protected then refer the below

Within Visual basic goto Projects ->references and Include
Windows Script host Object model.

And paste the following code ( I have written this in Command1_Click event…

Private Sub Command1_Click()
Dim snet As WshNetwork
Dim strRemotePath As String
Dim strDrive As String

strRemotePath = "\ServerNameShareName"
strDrive "P:"

Set snet = CreateObject("Wscript.WshNetwork")
Call snet.MapNetworkDrive(strDrive, strRemotePath, , "USERNAME", "PASSWORD")
' Do your Copy file Stuff here

'End copy file routine
Call snet.RemoveNetworkDrive(strDrive)
End Sub

Hope this Helps!

Regards,

Alice

Related Questions