1
Answer

Problem in connection with mysql

hi I'm getting problem in the connection with mysql
this is my coding in a class can anyone please tell me how to open the connection.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;


namespace library_management_system
{
    class Class1
    {
    }
    public class database1
    {
        public string cnn = "server=127.0.0.1;user=root;database=library management system;port=3306;password=password;";
        public string cmd;
        public string da;
        public string dr;      
    }
    public class conn
    {
        database1 x = new database1();
        MySqlConnection cnn1 = new MySqlConnection(cnn1.ConnectionString = x.cnn );
        cnn1 .open();
        MySqlCommand cmd = new MySqlCommand(x.cmd, cnn1);
       
    }
}



Answers (1)

0
Photo of Ramesh Palanivel
NA 9.5k 138.6k 8y
Hi Santosh,
 
Try this links, It may help you!..
 
https://www.codeproject.com/Tips/607801/SimpleplusChatplusprogramplusinplusC
 
http://www.c-sharpcorner.com/UploadFile/97ec13/how-to-make-a-chat-application-in-C-Sharp/