Results 1 to 12 of 12

Thread: How do I add MySql reference?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    245

    How do I add MySql reference?

    Hey guys, so a while ago I made a project in VB and made some MySQL connections to get some data and such however now I completely wiped my computer and want to add MySQL Conneciton and all the functions for MySQL but it's not in my .NET or COM references?
    Can someone please help me?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I add MySql reference?

    You have to download Connector/Net from MySQL and install it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    245

    Re: How do I add MySql reference?

    Quote Originally Posted by jmcilhinney View Post
    You have to download Connector/Net from MySQL and install it.
    Yeah I downloaded and installed it here
    http://dev.mysql.com/downloads/file.php?id=454041

    IS this not the correct installer for the MySql connector?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I add MySql reference?

    That is indeed the correct library. Once that's installed, you should be able to reference MySql.Data.dll in your projects. That library should be added from under Assemblies -> Extensions in the Reference Manager dialogue. Note that Connector/Net alone will only allow you to add that reference and write your own ADO.NET code. If you want VS integration then note this:
    Starting with version 6.7, Connector/Net will no longer include the MySQL for Visual Studio integration. That functionality is now available in a separate product called MySQL for Visual Studio available using the MySQL Installer for Windows (see http://dev.mysql.com/tech-resources/...r-windows.html).
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    245

    Re: How do I add MySql reference?

    Quote Originally Posted by jmcilhinney View Post
    That is indeed the correct library. Once that's installed, you should be able to reference MySql.Data.dll in your projects. That library should be added from under Assemblies -> Extensions in the Reference Manager dialogue. Note that Connector/Net alone will only allow you to add that reference and write your own ADO.NET code. If you want VS integration then note this:
    I keep trying to do this:
    Program -> Add Reference -> .NET -> MySQL.Data
    and Click ok and it's still giving me the unidentified error for these:
    MySqlConnection
    MySqlCommand
    MySqlDataReader

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I add MySql reference?

    Quote Originally Posted by therehere3 View Post
    I keep trying to do this:
    Program -> Add Reference -> .NET -> MySQL.Data
    and Click ok and it's still giving me the unidentified error for these:
    MySqlConnection
    MySqlCommand
    MySqlDataReader
    Adding a reference to an assembly gives you access to the types defined in that assembly. You still have to name them properly though. The fully qualified names are MySql.Data.MySqlClient.MySqlConnection, MySql.Data.MySqlClient.MySqlCommand and MySql.Data.MySqlClient.MySqlDataReader. Like all types, you have to either use their fully qualified names or else import the namespace that they're a member of, i.e. MySql.Data.MySqlClient. You can import the namespace at the file level or at the project level, on the same References page of the project properties that manages references.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    245

    Re: How do I add MySql reference?

    Quote Originally Posted by jmcilhinney View Post
    Adding a reference to an assembly gives you access to the types defined in that assembly. You still have to name them properly though. The fully qualified names are MySql.Data.MySqlClient.MySqlConnection, MySql.Data.MySqlClient.MySqlCommand and MySql.Data.MySqlClient.MySqlDataReader. Like all types, you have to either use their fully qualified names or else import the namespace that they're a member of, i.e. MySql.Data.MySqlClient. You can import the namespace at the file level or at the project level, on the same References page of the project properties that manages references.
    Yeah man I am not seeing why it's giving this stupid error....
    I have the reference MySql.Data and I used the import on the top of the code as this:
    Imports MySql.Data.MySqlClient
    and even tried this
    Imports MySql.Data


    Nothing is working... I am not sure what I am doing wrong here.

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I add MySql reference?

    What happens if you type this:
    Code:
    Dim obj As MySql.Data.MySqlClient.
    What options does Intellisense show you when you type the last dot?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    245

    Re: How do I add MySql reference?

    Quote Originally Posted by jmcilhinney View Post
    What happens if you type this:
    Code:
    Dim obj As MySql.Data.MySqlClient.
    What options does Intellisense show you when you type the last dot?
    I'm not that retarded :P

    If I start typing the "My" from MySql nothing happens in the Intellisence even then.
    So again it's all not defined it says.

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I add MySql reference?

    Noone said that you were retarded. We're not sitting in front of your computer seeing what you're seeing so we can either guess or ask you for information.

    Have you looked in the Object Browser to see what's available there? In fact, maybe post a screenshot of the References page of your project properties showing both the MySQL reference and namespace import, plus a screenshot of your Object Browser with any relevant MySQL nodes expanded.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    245

    Re: How do I add MySql reference?

    Quote Originally Posted by jmcilhinney View Post
    Noone said that you were retarded. We're not sitting in front of your computer seeing what you're seeing so we can either guess or ask you for information.

    Have you looked in the Object Browser to see what's available there? In fact, maybe post a screenshot of the References page of your project properties showing both the MySQL reference and namespace import, plus a screenshot of your Object Browser with any relevant MySQL nodes expanded.
    Awwhh got it now.
    Under my References it said the MySql was at version 0.0.0.0 so obviously some problem went wrong.
    Removed it and added it back in and works fine now.
    Thanks.

  12. #12
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I add MySql reference?

    Quote Originally Posted by therehere3 View Post
    Awwhh got it now.
    Under my References it said the MySql was at version 0.0.0.0 so obviously some problem went wrong.
    Removed it and added it back in and works fine now.
    Thanks.
    Damn! What a retard! Only kidding.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

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