title: how to connect to localhost with this code?
body: <p>i have a problem with this c# code. I need to connect it to mysql, localhost database, Please give me the correct code to [<strong>connetionString = "Data Source=ServerName;Initial Catalog=root;User ID=root;Password=";</strong> ] connect to the localhost.</p>
  
  <pre><code>using System;
  using System.Windows.Forms;
  using System.Data.SqlClient; 
  
  namespace WindowsApplication1
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              string connetionString = null;
              SqlConnection cnn ;
              **connetionString = "Data Source=ServerName;Initial Catalog=localhost;User ID=root;Password=";** 
              cnn = new SqlConnection(connetionString);
              try
              {
                  cnn.Open();
                  MessageBox.Show ("Connection Open ! ");
                  cnn.Close();
              }
              catch (Exception ex)
              {
                  MessageBox.Show("Can not open connection ! ");
              }
          }
      }
  }
  </code></pre>