Copy table from the musql to sqlite database

First, mysql connector/net, download it from here:

And for Sqlite connector, download it from here:

Now in your project  add reference to this dll file

·         C:\Program Files\MySQL\MySQL Connector Net 6.1.3\Assemblies\MySql.Data.dll

·         C:\Program Files\SQLite.NET\bin\System.Data.SQLite.dll


And now in your form add this

using MySql.Data.MySqlClient;

using System.Data.SQLite;

Finally add the following code to your application:


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using MySql.Data.MySqlClient;

using System.Data.SQLite;



namespace WindowsApplication23


    public partial class Form1 : Form


        public Form1()





        private void button1_Click(object sender, EventArgs e)


            string MyConString = "SERVER=localhost;DATABASE=mysql;UID=root;PASSWORD=123456;";

            string query="";

            MySqlConnection connection = new MySqlConnection(MyConString);

            MySqlCommand command = new MySqlCommand("select id,name from users", connection);

            MySqlDataReader Reader;


            SQLiteConnection conn = new SQLiteConnection("Data Source=E:\\contacts.db;Version=3;");






            Reader = command.ExecuteReader();

            int i = 0;

            while (Reader.Read())


                query = "insert into users(id,name) values(" + Reader.GetValue(0).ToString() + ",'" + Reader.GetValue(1).ToString() + "')";

                SQLiteCommand cmd = new SQLiteCommand(query, conn);




            MessageBox.Show(i.ToString()+" record transferred to MySql TO Sqlite database");