How do I retain database connectivity, with my project, when the source file path changes?

前端 未结 3 541
我在风中等你
我在风中等你 2021-01-07 11:38

I am using a Microsoft Access Database in my project; saved to the bin folder. What can I do, to ensure connectivity to that database, when the file path ch

3条回答
  •  醉酒成梦
    2021-01-07 12:18

    Yea, you should use:

    con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "MP1.accdb"
    

    And have the database file in the same folder as you startup .exe...

提交回复
热议问题