Get Connection to MySQL - CSharp Database

CSharp examples for Database:MySQL

Description

Get Connection to MySQL

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Data;
using System.Collections.Generic;
using System;/*ww  w  . ja  v a2  s . c o m*/
using MySql.Data.MySqlClient;

public class Main{
        public static MySqlConnection GetConnection()
        {            
            string connStr = "server=localhost;user id=root;password=;database=mysql";
            MySqlConnection rvalue = new MySqlConnection(connStr);
            return rvalue;
        }
}

Related Tutorials