Silverlight / WPF - I want to Develop a application but problem is that i want to keep my database in USB Driv

Asked By dipak jumade on 09-Apr-13 02:02 AM
I want to Develop a application In WPF. but problem is that i want to keep my database in USB Drive due to security reason.
Whenever i start Application it must search database from USB and then Access, otherwise it must alert for Database.
Guys Please Help me..give me solution For this.
Robbe Morris replied to dipak jumade on 09-Apr-13 07:29 AM
How does putting the database on a USB drive secure it?  Couldn't your user just make a copy of the database to their local drive?  How do you intend to give them access to the file without giving them access to the file?
dipak jumade replied to Robbe Morris on 09-Apr-13 08:03 AM
This Requirement id from my one of Client..He want to keep database with him..no one can access application in his absence.for this purpose we think to keep database in USB Drive..so if u have kind of solution ,plzz tell me
Robbe Morris replied to dipak jumade on 09-Apr-13 08:35 AM
Ah, ok.  You'll want to put the path to the database in your app.config.  This will enable him to adjust the drive letter should his USB port change.  Other than that, you should be all set.  Unless of course, he loses his USB drive.  :)
dipak jumade replied to Robbe Morris on 09-Apr-13 08:45 AM
Thanx for Reply.
I dont know how to get connectionstring to set in confige file...1st time he can use one usb port but 2nd time he may be use another...means every time connection string will be change according to USB port..how can i get connection string??
Robbe Morris replied to dipak jumade on 09-Apr-13 08:57 AM
No, not necessarily.  If he uses the same laptop/PC, the drive letter would usually stay the same.  If he uses multiple USB devices at the same time, it may differ.  He'll want to always plug his USB drive in first.  The System.Configuration assembly will need to be added as a reference if you do not already have it.

System.Configuration.ConfigurationManager

Here's how you get to it in C#:

<?xml version="1.0"?>
<configuration>
<connectionStrings>
 <add name="myconnectionstring" connectionString="the connection string goes here" />
 </connectionStrings>
</configuration>

C# code to get value:

ConfigurationManager.ConnectionStrings["myconnectionstring"].ConnectionString;

I got to be honest with you.  Working with configuration files is pretty basic stuff.  Does your client know how inexperienced you are developing WPF applications?

dipak jumade replied to Robbe Morris on 11-Apr-13 08:45 AM
That Doesn't matter for Client...he demands output.doesn't care for the way.
He need to keep database carry with him in USB.
and no 1 can even login without this Database.