Re: Windows forms application and database back-up

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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@xxxxxxxxxxxxxxxxxxxxxxx
James,

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@xxxxxxxxxxxxxxxx
Hi 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




.



Relevant Pages

  • Re: Windows forms application and database back-up
    ... But what I said is correct: the *.mdf cannot be copied if it is attached to SQL Server/Express. ... I was also going for the backup/restore, but rejected that because it has in my idea no advantages in a single user situation. ... attached to the SQL Server instance), ... 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. ...
    (microsoft.public.dotnet.general)
  • Re: There was a problem loading data: Generating user instance in SQL Server is disabled.
    ... I really suggest that even you can enable User Instance by using the SQL statement I provided previously, please read BOL before post again. ... Yes, I talk SQL Server and SQL Server Express without dsitinguashing them because in most cases, there is not differece in the regards of inexperienced users. ... Since you have already get it installed into a setting that is not meet the default requirement for those sample apps, you need to learnto reconfigure the system, or you could try to uninstall and then re-install, so you have chance to studybefore installing and configuring your OS to meet the all requirements and to get the installation right. ...
    (microsoft.public.vstudio.general)
  • Re: There was a problem loading data: Generating user instance in SQL Server is disabled.
    ... I getting the impression that this is a PHD only club, and I thought that it was for newbie as well ... Yes, I talk SQL Server and SQL Server Express without dsitinguashing them because in most cases, there is not differece in the regards of inexperienced users. ... USER INSTANCE, however, is only available to SQL Server Express. ... Since you have already get it installed into a setting that is not meet the default requirement for those sample apps, you need to learnto reconfigure the system, or you could try to uninstall and then re-install, so you have chance to studybefore installing and configuring your OS to meet the all requirements and to get the installation right. ...
    (microsoft.public.vstudio.general)
  • RE: using Membership on production server (Copy Web Site tool) - U
    ... I was aware of what "user instance" are and since I do want to have all ... "User instance" can let you use sql server mdf database file without ... authentication(instead of putting username/password in connection string). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: using Membership on production server (Copy Web Site tool)
    ... I do not want to use USER INSTANCE, ... Can I have many web app with each its own membership ... You need a bit more knowledge on SQL Server. ...
    (microsoft.public.dotnet.framework.aspnet)