Question How to create database backup?

dyomzkie

New member
Joined
Aug 7, 2011
Messages
3
Programming Experience
Beginner
Hi Guys,

can you help me out on creating a MySQL database backup through VB.NET coding? I want it to have a button for backup and restore for the convenience of the user.

thanks in advance:):tears_of_joy:
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,604
Location
Sydney, Australia
Programming Experience
10+
With SQL Server, you can open Management Studio, type in some SQL code containing a BACKUP DATABASE statement and execute it to backup the database. The SQL Server documentation can show you the appropriate SQL code. In VB, you can create a SqlConnection and a SqlCommand containing that same SQL code, then Open the connection and ExecuteNonQuery the command.

I don't use MySQL but I would assume that the situation would be similar. Go to the MySQL documentation and find out what SQL code you can use to backup a database using a management tool. Once you've tested the code and know it works, create a MySqlConnection and MySqlCommand to execute the same SQL from your VB app. You'll need to download and install Connector/Net from the MySQL web site if you haven't already.
 
Top Bottom