CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2005
    Posts
    38

    MySQL Connector Net 1.08 and C# (Closed)

    Hello everybody

    I want to connect to a MySQL 5.0 database under C# using the MySQL Connector Net 1.08 drivers. I know that I need to use the MySQLConnector object. But that object is not recognized by the compiler and I thus get a compilation error.

    Do I need to add some sort of reference in the IDE of the compiler?

    George Papadopoulos
    Last edited by divined; November 13th, 2006 at 04:27 AM.

  2. #2
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: MySQL Connector Net 1.08 and C#


  3. #3
    Join Date
    Apr 2005
    Posts
    38

    Re: MySQL Connector Net 1.08 and C#

    Fine. But the compiler responds with an error when I use the C# code :

    Code:
    MySql.Data.MySqlClient.MySqlConnection conn;
    string myConnectionString;
        
    myConnectionString = "server=127.0.0.1;uid=root;" +
        "pwd=12345;database=test;";
      
    try
    {
        conn = new MySql.Data.MySqlClient.MySqlConnection();
        conn.ConnectionString = myConnectionString;
        conn.Open();
    }
    catch (MySql.Data.MySqlClient.MySqlException ex)
    {
        MessageBox.Show(ex.Message);
    }
    and the error I get is

    Error 1 The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\divined\Τα έγγραφά μου\Visual Studio 2005\Projects\MySQL_test\MySQL_test\Program.cs 13 9 MySQL_test


    What namespace do I need to use in order for the MySQL namespace to be found?

    I added a reference to MySQL.Data.dll now but still the IDE of Visual Studio 2005 Express cannot find the MySQL namespace.
    Last edited by divined; November 10th, 2006 at 04:10 AM.

  4. #4
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: MySQL Connector Net 1.08 and C#


  5. #5
    Join Date
    Apr 2005
    Posts
    38

    Re: MySQL Connector Net 1.08 and C#

    thanks for the link. A rather focal point for anything related to MySQL Connector.

  6. #6
    Join Date
    Mar 2004
    Posts
    223

    Re: MySQL Connector Net 1.08 and C#

    Thats nice, Aniskhan.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured