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

前端 未结 3 504
我在风中等你
我在风中等你 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:01

    I use this simple code and I can move the folder any where

    conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\myDatabase.mdb"
    

    Make sure to save the access file in the bin folder for this connection string to work.

提交回复
热议问题