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()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
connString = "SERVER= 127.0.0.1;PORT=3306;DATABASE=database_name;UID=user;PASSWORD=pass;";
try
{
conn = new MySqlConnection();
conn.ConnectionString = connString;
conn.Open();
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"] + "");
}
conn.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}

}
}
}
















































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#?‎
C# - Connect To Cpanel MySql Database Remotely In C# C# - Connect To Cpanel MySql Database Remotely In C# Reviewed by Mursal Zheker on Kamis, November 12, 2015 Rating: 5

Tidak ada komentar:

Diberdayakan oleh Blogger.