locked
Can DataClassesDataContext be used to access a MySQL database? RRS feed

  • Question

  • User-696641838 posted

    My website is able to access a MySQL database when commands such as MySqlConnection and MySqlCommand are used. But server errors occur in my C# code wherever I use the DataClassesDataContext method to access table data such as:

    DataClassesDataContext db = new DataClassesDataContext()
    Profile profile = new Profile();
    profile.Names = Names;
    db.Profiles.InsertOnSubmit(profile);
    db.SubmitChanges();

    How can I make this form of data table access work with a MySQL database?

    Sunday, September 6, 2015 1:02 PM

Answers

  • User-821857111 posted

    Am I out of luck with this?
    No. Visual Studio 2013 and 2015 full versions (Community edition) are both free. There is no reason for you to be locked into such an old version.

    https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

    Obviously, if you can't or won't upgrade, you will have problems going forward. 2008 is a very old version and doesn't support a lot of what you are likely to get recommended in these forums.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 7, 2015 2:21 AM

All replies

  • User-821857111 posted

    If you want to use the Entity Framework with a MySQL database, you need to install the MySQL Entity Framework provider.

    http://lvasquez.github.io/2014/11/18/EntityFramework-MySql/

    https://www.nuget.org/packages/MySql.Data.Entity/

    Sunday, September 6, 2015 3:36 PM
  • User-696641838 posted

    WOW!!!  You have just saved me an enormous amount of work.  Thank you SO much!

    Maurice

    Sunday, September 6, 2015 4:46 PM
  • User-696641838 posted

    I attempted Installing and Updating NuGet Client by using the Command-Line Utility via Direct Download, but the nuget.exe file would not execute.  I attempted this because this appears to only work with Visual Studio 2010, 2012, 2013 or 2015 and I only have 2008.  Does this mean that I will not be able to install the Entity Framework or the Entity to make this work?  Am I out of luck with this?

    Maurice

    Sunday, September 6, 2015 5:25 PM
  • User-821857111 posted

    Am I out of luck with this?
    No. Visual Studio 2013 and 2015 full versions (Community edition) are both free. There is no reason for you to be locked into such an old version.

    https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

    Obviously, if you can't or won't upgrade, you will have problems going forward. 2008 is a very old version and doesn't support a lot of what you are likely to get recommended in these forums.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 7, 2015 2:21 AM
  • User-696641838 posted

    Hi Mike,

     You have pulled me back out of the fire again!  Back in 2008, I paid a lot of money to get the 2008 version of Visual Studio.  So, I expected to have to pay a lot more for the later versions.  I had no idea that they were free.  Thank you SO much!  I have just downloaded the 2015 version.  I can’t wait to try it out.  Then, I look forward to trying the installed version of the MySQL Entity Framework provider.  If this works, you will be my hero forever!

     Maurice

     

    Monday, September 7, 2015 3:35 PM