access folder at another computer with automatic Windows authentication

  • Thread starter Thread starter Andrius B.
  • Start date Start date
A

Andrius B.

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.
 
By the way, the installed OS on both computers are Windows XP.
I use Visual Basic 2005.
 
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
 
Back
Top