Jagroop Singh

Jagroop Singh

  • 1.6k
  • 71
  • 1.4k

Connectivity of Mysql

May 27 2016 1:53 AM

I am new to mysql. i have installed mysql workbench 6.3 CE and created database and one table and try to get data from window form application. Following is code for connectivity :

**String Conn = "Data Source = (LocalDB)\MSSQLLocalDB;Initial Catalog=employee;uid=root;pwd=1234"; String sql = "Select first_name from tbl_employees"; SqlConnection con = new SqlConnection(Conn);

SqlCommand cmd = new SqlCommand(sql, con);**

        using  ( SqlDataAdapter dr = new SqlDataAdapter(cmd))         {             DataSet ds = new DataSet();             dr.Fill(ds);             GV1.DataSource = ds;             GV1.DataBind();         }      } 

When i run this application then i get following error:

**An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code

Additional information: Login failed for user 'root'**

I have checked in mysql users i have granted full privilege and i have checked with command prompt as well. mysql -u jagroop -p and i am able to login. Plzzzzzzzzzzzzz suggest me what i can do to solve this.

Thanks in advance


Answers (3)