469,344 Members | 6,274 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,344 developers. It's quick & easy.

access folder at another computer with automatic Windows authentication

Hi.
I am writing an app, whitch has to access a database, located on another
computer (Intranet).
Let's say, the computer where the app is to be installed, is "Computer1".
The computer with the database is "Computer2", and the full path to needed
database is "\\Computer2\AppFolder\mydata.mdb".
The user can access that folder when it authenticates as "user1" with
password "password1".
Question: how to automate the connection, making it possible to log to the
computer2 automaticaly at run time programically?
By default, the app, without authenticating, cannot open that database, so
it shows FileOpen dialog for browsing to the desired computer, then to the
shared folder, at this step the input form appears, asking to enter username
and password; the app's user enters them, and succesfully enters the folder
and selects the database, and the connenction is performed.
So, could this be done faster, eg. writing some parameters to the database's
connection string, o using IO.System objects or so on?
The code below describes the connection to db:

' Start of code
Dim sConnSample = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False; Jet OLEDB:Database Password=andriusbl5; " &
"Data Source=" & \\Computer2\AppFolder\mydata.mdb
ADODBconn = New ADODB.Connection
ADODBconn.Mode = ADODB.ConnectModeEnum.adModeReadWrite
ADODBconn.Open(sConnSample)
' End of code

So, should I add some parameters to cConnSample, like "UserId" ?
Thanks in advance.
Jan 18 '08 #1
2 5852
By the way, the installed OS on both computers are Windows XP.
I use Visual Basic 2005.
"Andrius B." <an*******@mail.ltwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
Hi.
I am writing an app, whitch has to access a database, located on another
computer (Intranet).
Let's say, the computer where the app is to be installed, is "Computer1".
The computer with the database is "Computer2", and the full path to needed
database is "\\Computer2\AppFolder\mydata.mdb".
The user can access that folder when it authenticates as "user1" with
password "password1".
Question: how to automate the connection, making it possible to log to the
computer2 automaticaly at run time programically?
By default, the app, without authenticating, cannot open that database,
so it shows FileOpen dialog for browsing to the desired computer, then to
the shared folder, at this step the input form appears, asking to enter
username and password; the app's user enters them, and succesfully enters
the folder and selects the database, and the connenction is performed.
So, could this be done faster, eg. writing some parameters to the
database's connection string, o using IO.System objects or so on?
The code below describes the connection to db:

' Start of code
Dim sConnSample = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False; Jet OLEDB:Database Password=andriusbl5; " &
"Data Source=" & \\Computer2\AppFolder\mydata.mdb
ADODBconn = New ADODB.Connection
ADODBconn.Mode = ADODB.ConnectModeEnum.adModeReadWrite
ADODBconn.Open(sConnSample)
' End of code

So, should I add some parameters to cConnSample, like "UserId" ?
Thanks in advance.

Jan 18 '08 #2
Hi Andrius,
You will need to MAP the network drive using network credentials and then
you can access the database. One way of setting up a Map drive would be to
use Process.Start along with NET USE Dos command.

Shuja

"Andrius B." <an*******@mail.ltwrote in message
news:#L**************@TK2MSFTNGP03.phx.gbl...
By the way, the installed OS on both computers are Windows XP.
I use Visual Basic 2005.
"Andrius B." <an*******@mail.ltwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
>Hi.
I am writing an app, whitch has to access a database, located on another
computer (Intranet).
Let's say, the computer where the app is to be installed, is "Computer1".
The computer with the database is "Computer2", and the full path to
needed database is "\\Computer2\AppFolder\mydata.mdb".
The user can access that folder when it authenticates as "user1" with
password "password1".
Question: how to automate the connection, making it possible to log to
the computer2 automaticaly at run time programically?
By default, the app, without authenticating, cannot open that database,
so it shows FileOpen dialog for browsing to the desired computer, then to
the shared folder, at this step the input form appears, asking to enter
username and password; the app's user enters them, and succesfully enters
the folder and selects the database, and the connenction is performed.
So, could this be done faster, eg. writing some parameters to the
database's connection string, o using IO.System objects or so on?
The code below describes the connection to db:

' Start of code
Dim sConnSample = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False; Jet OLEDB:Database Password=andriusbl5; " &
"Data Source=" & \\Computer2\AppFolder\mydata.mdb
ADODBconn = New ADODB.Connection
ADODBconn.Mode = ADODB.ConnectModeEnum.adModeReadWrite
ADODBconn.Open(sConnSample)
' End of code

So, should I add some parameters to cConnSample, like "UserId" ?
Thanks in advance.

Jan 18 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Peter Frost | last post: by
12 posts views Thread by Chad Crowder | last post: by
1 post views Thread by Microsoft News | last post: by
1 post views Thread by Jody Gelowitz | last post: by
4 posts views Thread by TrinityPete | last post: by
52 posts views Thread by Neil | last post: by
17 posts views Thread by rdemyan via AccessMonster.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.