I want to backup my Database in MySQL for Each time Application is Closing.
I googled for the DUMP in MySQL. but i got only php or batch file programs.
Any one know how to Backup Automatically Mysql in C# coding?.
Or Executing Batch is the Only way. Is it possible in Winform C#?.
My Connection String is -
connectionString="server=192.168.1.100;User Id=root;database=mcs_sps;Persist Security Info=True"
Thanks in Advance!.
There are good samples and a good best practice in the following link: http://forums.mysql.com/read.php?47,214274,214274#msg-214274
I think your best shot is that aL3891 suggests unless you do not want to pay . If you want to pay for this simple task check out these links:
http://www.devart.com/dotconnect/mysql/docs/Devart.Data.MySql~Devart.Data.MySql.MySqlDump.html
http://www.devart.com/
Using the Process class you can start an instance of Mysqldump or Mysqlhotcopy, command-line programs for dumping an entire mysql database.
The best solution is this http://www.codeproject.com/Articles/256466/MySqlBackup-NET-MySQL-Backup-Solution-for-Csharp-V
I tried it in my application and it works perfectly
Related
i have an old (.db) database file and i need to extract the contents of it or to use it with a c# application but i dont know which software to use please help me
check this link that lists the db file types.
http://www.file-extensions.org/search/?searchstring=db&searchtype=2
thank you
Well, checking the link in your question, I could browse through the apps that were related to DB extension. And after a quick analysis, I think dBASE will to what you need.
http://www.file-extensions.org/dbase-file-extensions
It allows you to open, edit, save and convert to another extension that might suits you better.
I guess that MS Access and SQLite can do the same thing dBASE will do for you.
The problem is, that *.db has been used by many programs.
Using any Unixoid system (Linux, BSD, MacOS) you can use the file(1) utility to get the program which probably created that file. Using this information you can then ask for more specific help here.
As an example for my *.db files and the output of file:
/etc/libgda-4.0/sales_test.db: SQLite 3.x database
/home/XXX/.mozilla/firefox/cert8.db: Berkeley DB 1.85 (Hash, version 2, native
/var/cache/man/cs/index.db: GNU dbm 1.x or ndbm database,
I have created a C# windows application with vs2010 and I'm using a SQL Server CE database. I'm looking for a way to backup my database programmatically.
Is there a way to export/import my entire database (as a .sdf file) or just copy it to another location and then import it and replace the current one?Could anyone provide me the code in order to do this?
I'm relatively new to this but I'm guessing this is not something as difficult as it sounds. I couldn't find a clear answer anywhere so any help would be appreciated!
File.Copy will do the job, I believe. You can get the full path from the SqlCeConnection.Database property
I'm working on a C# application that reads/saves data in some old dbf-files.
(using Microsoft Visual FoxPro - driver)
I haven't had any problems until recently, when i tried querying a table i had'nt used before and i got this error message. This table is somewhat special since it has 500+ columns, i suspect that this might have something to do with it - but nothing I've googled so far gives any indications to this causing any problems.
I've had a look at this document and checked that the header record count matches the actual count (1 record);
This document is the only good tip I've found so far, that does not require any heavy dbf-repair tools.
I've tried using both the Microsoft Visual FoxPro - and the VFPOLEDB driver, they both give more or less the same error message.
I've tried passing the TableValidate = 0 command, without success.
Does anybody have any experience with a way to solve/work around this, preferably using C#.
VFP tables don't support 500 columns, so this isn't a VFP table. You need to find out what kind of table it is and use the appropriate driver to open it.
If the table is damaged, you can use CmRepair.app to fix it. This program is a Visual Foxpro 8 application (not a compiled .EXE), so you need VFP to execute it.
If you don't have VFP installed, you can download an utility program I made to execute VFP scripts and .APPs in customers that haven't VFP installed. The VFP8 runtimes are available here. Then you run the program with runner CmRepair.app and repair the table.
Good luck!
From the comment from Tamar, it got me to thinking of yet another application database that used .DBF file formats... Clipper. Here's a link that describes their table capacities..
Apollo database - (Clipper)
This might be a missing link you are looking for.
My aim is to backup a database (.mdf) as one file with my web application project written in C#.
The backup should later on be loaded on a "restore"-page, where the data in the backed-up tables could be appended to the original database row by row.
What would be a good practice to implement this?
I thought of just copying the mdf file, but then I read about attaching and detaching of the database. Furthermore I don't know what to do with the _log.ldf file.
I'm looking forward to your hints. Thank you in advance for your help!
EDIT: I can only use the free SQL Server Express for this, because I want to distribute my program to other people.
Probably, you refer to the Backup and Restore using C# for Sql Server to get a complete idea about writting a code in C#, which has helped me a lot when I was using it.
By the use of Backup class in C#, you can get all the facilities to backup as well as restore.
If you are only interested in appending the data rowwise afterwards, perhaps it is easier to export each table to CSV and import it afterwards (so you have rowwwise control in C#).
If you insist ine one file, just add all the CSV's to a zip.
You can use the FileHelpers library for this (http://www.filehelpers.com/) and you will have it up&running in no time.
Apparently there is a Backup class in the SQL Server Management Objects library.
You might want to check that out first, as it doesn't look overly complicated:
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.backup.aspx
It would require you to have two or three libraries installed on the server you run it on, though they are fairly small - not Windows SDK sized...
pls go through this link on how to backup data and restore using c# and sql server .In addition to you have to add these names spaces
Microsoft.SqlServer.Management.Smo;
Microsoft.SqlServer.Management.Common;
I'm programming a fairly simple application which I want to cut to just one simple EXE file + some data storage (XML for example).
My question is regarding configuration files. Where to put those files? I saw a few applications that have just an EXE file (uTorrent, Media Player Classic - I can use them without any installation), but they store their config somewhere else. How to achieve this?
How would you approach such situation? Is it better to try to achieve the thing I described above, or simply use a configuration file and data storage in the same directory as the EXE file?
Creating or using a file in the same folder (or in the App_Data) is pretty standard practice.
You use an installer like Inno Setup (free) to create a single exe installer (http://www.jrsoftware.org/isinfo.php)
If you want a DB rather than XML, have a look at SQLite (http://www.sqlite.org/) a file based DB or use an MS Access DB.
I think you want to take a look at Application Settings. This is an API which allows you to save user or application settings using a strongly typed API. Under the hood the settings are stored via XML serialization.
This API works with virtually every type of .Net application including low permission Click Once versions. It does the work of finding the place on disk appropriate for storing the data and completely hides it from you. It also has a nice GUI integration into Visual Studio.
EXE-only programs store their data either in the Windows Registry or in the user's Application Data/AppData folder. Although this may appear cleaner at first, it just hides the ugliness of scattering all your data around. I would suggest just going with a simple XML/INI/text data file that is generated when needed and easy to migrate.
Please see: WPF/C#: Where should I be saving user preferences files?
You could use the app.config file for storing your configuration. For the data, I would sugest something like db4o or SQLite.
Edit
This tutorial can show you how simple is to use db40 to store and retrieve your data.
Do not forget Isolated Storage. It gives you a place to read and write files to without the need for you to specify a location. Sometimes it is the only way sandboxed applications (like Silverlight) can store user or machine specific data locally. See here for an example.
I would store them in the same directory. That just seems easier to me, at least that's the way I always do it.