views:

23

answers:

0

On click of a button in asp.net c# i defined the following method to insert the data into the database.

Is my insert query correct for mysql??I am not able to insert the data into the database. browser also is not throwing any errors.

Can anyone help me to sort out the problem in my code?

 protected void Button2_Click(object sender, EventArgs e)
    {
        try
        {
            Response.Write("p");
            myConn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=ishan; User=root;Password=root;Option=3;");

            myConn.Open();
            Response.Write("kkj");
            string sql = "insert into ishan.route (nmae, order) VALUES ('1', 'ishan')";

            OdbcCommand cmd = new OdbcCommand(sql, myConn);
            cmd.ExecuteNonQuery();

            myConn.Close();
        }
        catch (Exception ess)
        { }
    }

i am now getting the following exception.

ERROR [HY000] [MySQL][ODBC 3.51 Driver]Access denied for user 'root'@'localhost' (using password: NO)

any solutions to it?? i had my userid and password as root