VB .NET CONNECT TO LOCAL .MDB

2019-08-27 12:45发布

问题:

Hi guys can u tell me how can I connect to the protected by login and password local computer and open a .mdb file which one is on this computer?

Below is a code where Z is a local computer but B is a folder where we have our database. But all time i got error with that i dont have premission to open magazyn.mdb. Can u tell me what i must add to this connectionString to open this .mdb file

 conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & _
"\\z\b\magazyn.mdb;"

回答1:

Something like this:

conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"\\z\b\magazyn.mdb;User Id=admin;Password=password;"

See here for further examples.



回答2:

You're accessing database file on shared folder. You must set share \\z\b properties (and file system security too) to allow read/write access and additionally allow file creation - access needs to create lock (*.ldf) file.