المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Use a database like a resource



C# Programming
07-05-2010, 02:13 AM
Hi

I am using a database in my application, but I can't help feeling I'm doing it the wrong way...
Currently I make a connection using the absolute path to the database.

DBConn = New SqlCeConnection("Data Source = " + path + "; Password=" + DBPass);
This path is stored in the registry. However the first time the app runs, there will be no such path.
Is there any way to link the application code to the database like using resources, such as images?
Or some sort of relative path? Since the database shows in my solution explorer, I figured there should be a way.
Things get really messed up when publishing the app. I have to ask the user where he stored the database http://www.barakasoft.com/script/Forums/Images/smiley_doh.gif
Any hints?

Greetz
Steven Solberg