Problem in connection with mysql

May 2 2012 1:20 PM
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)