- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi folks
I have created an autocad .net dll. it compiles and runs fine on my computer. I am also connecting to a database. So I am using Visual Studio to store a connection string to that databse. This connection string basically tells whoever's asking, where my Database is. I have stored this connection string using Visual Studio. Basically, in Visual Studio: you click on: Project --> Project_name Properties ---> And you have all the application/user settings. I've just added a connection string there.
(Please see attached screen capture):
Here is how I create the connection in my code:
OleDbConnection connection = new OleDbConnection(Bubble_Deck.Properties.Settings.Default.Bubble_DeckConnectionString);
In other words it doesn't look like (???) i'm hard coding this because the connection string looks at what the XML file contains.
And the value of the connection string is: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Koshy\Documents\Drawings and Clients\Bubble Deck3.mdb
What is the problem?
Works fine on my computer. But what if want to deploy it to another computer?
What I'm doing now when deploying?
I simply go to the Release folder in Visual Studio. I cut and paste the dll in that folder and I give it to my colleague. He then runs it but there's an error:
"Could not find the file 'C:\Users\Koshy\Documents\Drawings and Clients\Bubble Deck.mdb" at ......etc etc etc
Now on my colleague's computer, I want to change the connection string so that it points to the database on his particular machine. Because it is obviously still pointing to the path specified in my computer. How do I do that?
Obviously it's coded somewhere in my DLL because it's doing that without even me giving my colleague a config file.
In short, how do I change the connectionString to point to the new database location on his computer?
- Do I need to copy over the dll's config file and paste the contexts of that file into acad.exe 's config file?
I'm very lost as to how this works. It will probably take you guys less than 2 minutes to work this out, but me, knowing nothing, i am sure it could quite easily take me 2 hours, if not 2 days to work it out. any advice much appreciated.
regards
BK
Resources for those researching this problem in the future:
Here are some wonderful links (and attachments) on configuration files - which i'm steadily working through. I trust future readers will find them useful.
http://adndevblog.typepad.com/aec/2014/09/get-value-from-appconfig-file-and-sur-la-france.html
http://www.codeproject.com/Articles/16466/Unraveling-the-Mysteries-of-NET-Configuration
- Please see attached pdf document - a valuable resource.
Solved! Go to Solution.