Thursday, November 12, 2015

C# - Connect To Cpanel MySql Database Remotely In C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace MySqlConn
    public partial class Form1 : Form
        MySqlConnection conn;
        string connString;
        public Form1()

        private void button1_Click(object sender, EventArgs e)
            connString = "SERVER=;PORT=3306;DATABASE=database_name;UID=user;PASSWORD=pass;";
                conn = new MySqlConnection();
                conn.ConnectionString = connString;
                MessageBox.Show("connection success");

                string query = "SELECT * FROM employee_data";
                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, conn);
                //Create a data reader and Execute the command
                MySqlDataReader dataReader = cmd.ExecuteReader();

                //Read the data and store them in the list
                while (dataReader.Read())
                    Console.WriteLine(dataReader["id"] + "");
                    Console.WriteLine(dataReader["name"] + "");
                    Console.WriteLine(dataReader["surname"] + "");
                    Console.WriteLine(dataReader["age"] + "");
            catch (MySql.Data.MySqlClient.MySqlException ex)


Connect C# to MySQL
How to Connect to MySQL Using C#
c# - How to connect to MySQL Database?
MySQL .NET With C#
C# Windows Form Application Mysql Connection
c# - How can I connect to MySQL from windows forms?
Using Visual C# Windows Forms with MySQL
C# Programming for beginners: How to connect MySQL Database
Windows Form Application using Mysql Server 
Connect MySQL from C# Windows Forms 
mysql problem to connect with windows form c#
C# Windows Form Application Mysql Connection
Mysql And Visual C# 2010 Windows Form Application
MySQL :: Connecting to MySQL with a Windows Form application
C# Form textbox string into SQL Database
visual c# CLR windows form application and mysql
assembly reference not working in C# script
Trying to connect to MySQL from C# application 
mysql and C# window form application
How to connect MySQL using C#?‎
IT Certification Category (English)640x480

Partner Sites

Top Online Courses From ProgrammingKnowledge

Python Course
Java Course
Bash Course
Linux Course
C Course
C++ Course
PHP Course
Android Course
C# Course
JavaFx Course
NodeJs Course
Jenkins Course
Scala Course
Bootstrap Course
MongoDB Course
QT C++ GUI Course