When transfering file to another location i always need to change the source or directory..

Dim cnn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Renz\Desktop\FINAL\Database\AuditDB.mdb")

Is there a way I can avoid that?

有帮助吗?

解决方案

You could use a path relative to your applications location, e.g.

Dim cnn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database\AuditDB.mdb")

Where in this example I am presuming that your database is stored in a folder called Database in the same folder as your program.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top