3
Answers

Connectivity of Mysql

Jagroop Singh

Jagroop Singh

8y
291
1

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)