Help with connection string

Posted by DanSogaard on Stack Overflow See other posts from Stack Overflow or by DanSogaard
Published on 2010-03-20T20:31:00Z Indexed on 2010/03/20 20:41 UTC
Read the original article Hit count: 575

Filed under:
|

So I'm trying to connect to my database at the specified location, and the connection is established as long as the db at the same location specified at DataSource field, but what if I tried to distribute my application, the file path will change and will lead to errors I want to avoid. Here is my connstring:

string connstring = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\PC1\Documents\Visual Studio 2008\Projects\Test\Test\bin\Debug\MyDatabase01.accdb;Persist Security Info=true";

Is there anyway I can define DataSource location to be at the same folder?.

© Stack Overflow or respective owner

Related posts about c#

Related posts about connection-string