Results 1 to 1 of 1
  1. #1
    Join Date
    Jan 2005

    Question Unanswered: VS.NET C# & MySQL connection errors - Please help


    I have been trying to fix this issue for quiet some time now. You will see the error below. Here is what I have done already.
    1. I have ODBC 3.51 Driver installed
    2. I have MySQL 4.1.8 installed with username root and testuser.
    3. I have also created an ODBC DSN named TestLocalDB under the user and the system DSN. The connection works fine when I test it under ODBC Data Source Administrator.
    4. I am using C# to connect to the DB using ODBC. Here is my code:

    private void Button1_Click(object sender, System.EventArgs e)
    OdbcConnection myConn = new OdbcConnection("DSN=TestLocalDB");
    string myInsertQuery = "INSERT INTO Login_Info (user_id, password) Values('test', 'password')";
    OdbcCommand myOdbcCommand = new OdbcCommand(myInsertQuery);
    myOdbcCommand.Connection = myConn;
    Also, when I run the mysqladmin command from the prompt, I get the following along with other stuff:

    Variables (--variable-name=value)
    and boolean options {FALSE|TRUE} Value (after reading options)
    --------------------------------- -----------------------------
    count 0
    force FALSE
    compress FALSE
    character-sets-dir (No default value)
    host (No default value)
    port 3306
    relative FALSE
    shared-memory-base-name (No default value)
    socket (No default value)
    sleep 0
    user (No default value)
    verbose FALSE
    vertical FALSE
    connect_timeout 43200
    shutdown_timeout 3600
    As you may notice that for the user, there is No default value. How can I fix that??


    Server Error in '/TestApp' Application.

    ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Access denied for user 'ODBC'@'localhost' (using password: NO)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.Odbc.OdbcException: ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Access denied for user 'ODBC'@'localhost' (using password: NO)

    Source Error:

    Line 53: OdbcCommand myOdbcCommand = new OdbcCommand(myInsertQuery);
    Line 54: myOdbcCommand.Connection = myConn;
    Line 55: myConn.Open();
    Line 56: myOdbcCommand.ExecuteNonQuery();
    Line 57: myOdbcCommand.Connection.Close();

    Source File: c:\documents and settings\sprint\vswebcache\chsf47vrl21\testapp\web form1.aspx.cs Line: 55

    Stack Trace:

    [OdbcException: ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Access denied for user 'ODBC'@'localhost' (using password: NO)]
    TestApp.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\documents and settings\sprint\vswebcache\chsf47vrl21\testapp\web form1.aspx.cs:55
    System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)

    Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
    Last edited by holyinsomniac; 01-07-05 at 16:07.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts