Re: Windows forms application and database back-up
- From: "Cor Ligthert[MVP]" <Notmyfirstname@xxxxxxxxx>
- Date: Thu, 29 Jan 2009 07:37:25 +0100
Norman,
Why should it be running in a single user operation?
What you write is valid as it is running as multi user source, but as it is single user like the OP wrote, than in my idea simple make copies has the same effect.
I was also going for the backup/restore, but rejected that because it has in my idea no advantages in a single user situation.
Cor
"Norman Yuan" <FakeName@xxxxxxxxxxxxx> wrote in message news:ugT5pQXgJHA.4900@xxxxxxxxxxxxxxxxxxxxxxx
If the local SQL Server Express is running (meaning *.mdf/*.ldf is attached to the SQL Server instance), the files cannot be copied.
To the OP:
Depending on how the user logs in to the SQL Server instance, if he/she has the permission to do the backup/restore, then you can have your app to run BACK DATABASE..../RESTORE DATABASE... TSQL statement to do the backup. YOu can also look into SMO object model to incorporate your app to do the backup/restore.
The other option would be to use SQL Server Express' USER INSTANCE, to which, the user do not have to have local admin rigth to attach database to SQL Server Express instance. With USER INSTANCE, you can get the *.mdf file easily attached to SQL Server Express at begining of your app and detached and a backup copy created when your app is done.
However, be warned, USER INSTANCE is an advanced feature and only available to SQL Server Express2005/8, and rumor has it that USER INSTANCE feature will be dropped from next SQL Server version, because it causes more trouble (due to the lack of understanding, IMO) than benefit.
"Cor Ligthert[MVP]" <Notmyfirstname@xxxxxxxxx> wrote in message news:u%231F34SgJHA.4868@xxxxxxxxxxxxxxxxxxxxxxxJames,
You can always simple use a simple File.Copy for this, (and copy the LDF file as well)
Set your original database on a for the user accessable place to make it even easier.
http://msdn.microsoft.com/en-us/library/system.io.file.copy.aspx
Cor
"James Page" <JamesPage@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:EDBFF4E5-D8C0-4503-B2CE-664DB5960EEC@xxxxxxxxxxxxxxxxHi all - hope this is the right forum!
I have a simple vb.net windows forms application which uses data from an
underlying sql express database.
It is deployed in a single user environment and the sql express package is
installed in the default location.
I want to be able to allow the user to backup and restore the underlying
.mdf datafile.
Can anyone give me a couple of pointers on the best way to achieve this?
Many thanks
.
- Follow-Ups:
- Re: Windows forms application and database back-up
- From: Norman Yuan
- Re: Windows forms application and database back-up
- From: James Page
- Re: Windows forms application and database back-up
- References:
- Windows forms application and database back-up
- From: James Page
- Re: Windows forms application and database back-up
- From: Cor Ligthert[MVP]
- Re: Windows forms application and database back-up
- From: Norman Yuan
- Windows forms application and database back-up
- Prev by Date: Re: Anything wrong with the way I use "break"s in my loops?
- Next by Date: Re: Anything wrong with the way I use "break"s in my loops?
- Previous by thread: Re: Windows forms application and database back-up
- Next by thread: Re: Windows forms application and database back-up
- Index(es):
Relevant Pages
|