-4

Try to make my app read the ms-access database from shortcut of my database it failed to read, so try to change the location of database dynamically ( there is an option in the app to move the database to drop-box folder and create a shortcut to that database in app folder )

try to make an shortcut to the moved ms-database

the app to read the database or to change the location of database dynamically

  • Welcome to Stack Overflow. It is not clear from your question what you are asking. Be sure and read [How to ask a good question](https://stackoverflow.com/help/how-to-ask) and provide a [minimal, complete, verifiable example](https://stackoverflow.com/help/mcve) in your question so we can help you with a good answer. – Charlie Wallace Apr 13 '19 at 22:22

2 Answers2

1
  1. First of all, you should create a folder with a clear name in your VB.Net application path, namely inside the project Debug folder, let's name that folder as "MyProjFiles", so it will be in this path: ProjectFolderName\bin\Debug\MyProjFiles

  2. Put your whole projects files inside our lovely folder MyProjFiles, including all types of your attachments: database, images, sounds, files, etc.

  3. Call your database or whatever of those attachments files in addition to our \MyProjFiles\ using this method: My.Computer.FileSystem.CurrentDirectory & "\MyProjFiles\YourFilesPathHere.EXT".

  4. Now, the whole path will be such as this string: "C:\CurrentUserNam\RootFolder\ProjectFolderName\bin\Debug\MyProjFiles\YourFilesPathHere.EXT"

For great practical example of this, supposuply let's open our MSAccessDB.accdb which is already copied into our project folder \MyProjFiles\ by this code directly:

System.Diagnostics.Process.Start(My.Computer.FileSystem.CurrentDirectory() & "\MyProjFiles\MSAccessDB.accdb")

The result will be simply opening our database which called "MSAccessDB.accdb"

Or open some pdf files such as this line:

System.Diagnostics.Process.Start(My.Computer.FileSystem.CurrentDirector() & "\MyProjFiles\MyPdfFile.pdf")

and so on.

I hope this can help you all brothers. Best ^_^ Regards.

Calaf
  • 1,133
  • 2
  • 9
  • 22
MAMPRO
  • 69
  • 6
0

You should read this link. It explains how to read the information you need to give the access Datareader something to do. .NET read binary contents of .lnk file

Maybe this is enough, so you don't need to copy anything.

nbk
  • 45,398
  • 8
  • 30
  • 47