In winforms application I want to backup my database once for every week. How can i do this. Can it be done through Coding or should I go for batch file? And the backup must be done automatically with out any user interface..
You could do it either way.
If you write a batch file, you can have the Windows Scheduler run this file once a week.
Either way, you must make sure the database is closed before running the backup. This may be easier with code.
Use the Copy method of the System.IO.File class.
Related
I am planning to make a C# desktop app with SQL Server 2019 Express.
Because I am not so familiar with SQL Sever, it'd be appreciated if any advice given on the feasibility of my thoughts, thanks in advance!
Here are my planned backup strategies:
This app is for personal use, I make it and I use it.
Any modification to the database will be wrapped as a transaction.
Full backup of the target database will be conducted once a day, and differential backup EVERY TIME after successfully committed a transaction.
All backups are using BACKUP statement through C# code.
Questions:
Because I have backup for every modification, so I can just use "Simple" restore model, and there is no need to use Transaction Log backup, is that right?
For the same reason, I don't need to backup every time I close the app, right?
Why I am asking this is because differential backup take about 560KB even right after a full backup and without any change.
Do I need to backup system databases other than the one used by the app?
(I might change hosting pc in the future, can the backups be restored to other SQL Server instances without system databases backups?)
Thanks!
I have written certain code to take the Backup of a Database, the application will take the Database Backup automatically at the time Specified. Now, I want some help to take Successive Backup of the Same Database which was taken previously and dont want to take Complete Database Backup again and again. Can any one Help me.
How to make incremental backups with MS Sql Server in c# : http://www.mssqltips.com/tip.asp?tip=1849
I have a text file that several instances of the same app use to synchronize and exchange data between themselves. In a nutshell it's a plain text file that contains list of data files. These data files come and go on a regular basis.
Is there a reliable way to know that some app wrote to the file since it was last read from? Normally you would use Modified date for it. However the file is accessed so frequently that it will likely be constantly present in memory cache. So there is a flight chance that writing to the file will not alter Modification date.
Is there any other way to know that file was changed.
I know about file system notifications but would rather not use them here.
The software is in C# but obviously I can also use any WinAPI function via InteropServices. Software runs on Windows Server 2008 R2. File system is NTFS. Ideally the method should also work on network shares.
One interesing but (AFAI) barely used feature of ntfs is it's USN Journal, which you can read. It maintaines a list of all changes to the filesystem. The only program I know which explicitly uses it is Everything. But it might be that the FileSystemWatcher is using it internally. Big advantage of reading this log manually is that you can figure out changes that happend while your program was not running.
May be better use sql data base for this. Otherwise you must organize a transaction mechanism for this file.
How about using a hash (MD5 or SHA1 etc) of the file contents to determine if the file has been modified?
Each time you access the file save its Hash (SHA2) and then in the future create a Hash again and compare it to what was saved previously.
Simple and elegant.
I want to create a GUI with C++ (QT4). The GUI should work on Windows and should be able to
create a database
use the database created by it (I should use an existing DBMS, in order not to worry for queries)
database should be specific to the GUI, other software should not be able to use that database (the database may be for example encoded)
the gui with its ability of working with database should be easily installed on the other computers, that is I don't won't to ask user to change some options on his computer manually
So my questions are:
What kind of database can help me to do this, what I should learn connected with database to be able to perform this task?
Should I encode the database by my GUI, or databases have such command to save them on disk already encoded?
Thanks!
You could try looking into SQLite. The library can be used with C++. It will not need an external DBMS. SQLite is embedded into your application, and you can access you database through it. Also, the database files it produces can be encoded, so it will be accessible to your application only.
first, you should decide what are the scenario your system going to be applied.
then only proceed to source for database provider (MySQL, Postgres, etc).
you can't really jump to UI implementation straight away because all of the database mentioned above can do what you need.
I am in the beginning stages of developing a solution to decrypt the hard drives of a few thousand laptops.
I have a thought that it would be useful to create a parent application that would handle all of the database calls, client updates, client commands and status updates. This application would either run as a service or as a .EXE from the computers start up.
Then have a child application perform all of the decryption and verification duties with logging to a XML file.
It is the child that I am thinking may need to be updated in the event new functionality is needed. That is where I am trying to think of the most logical way of updating it, my first thought went to storing it in SQL as a BLOB, and then pulling it down from the parent application if needed.
Does this sound reasonable? One item to note is that my target computers are all at .NET 2.0.
Ms. SQL Server 2008 introduces FILESTREAM storage which gives you both the benefit from DBMS and speed of Filesystem. Worth having a look at it.
http://msdn.microsoft.com/en-us/library/bb933993.aspx
Possible? Probably. Recommended? Probably not.
Is there any reason why you can't store the executable on a file share and have an entry in the database which points to a UNC path for the client to collect the file itself.
The file share is best for serving files so use it as such.