|The easiest way to get a connection string to do what you want is to use the Universal Data Link dialog. To do this:
You should now get a property sheet labelled 'Data Link Properties'.
- Create a new text file on the desktop
- Rename it to 'access.udl' (the icon should change to a computer in front of a table)
- Double-click the icon
Go to the Provider tab and select the Microsoft Jet 4.0 OLE DB Provider. Go to Connection and browse to the database you want to open, then ensure the username and password are correct. Choose 'Test Connection' to check you're all right so far. On the Advanced tab, under Access Permissions uncheck Share Deny None and check Share Exclusive. Click OK.
Now open the .UDL file in Notepad. It should look something like:
; Everything after this line is an OLE DB initstring
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\MyDB.mdb;Mode=Share Deny Read|Share Deny Write;Persist Security Info=False
I hope that shows alright on your browser; CodeProject converts [semicolon][P] into a smiley...;P
Copy the initialisation string into your code, and you should be done.