none
MySQL Connector error with create dataadapters RRS feed

  • Question

  • I get one issues when I try to create dataadaper with MySQL providers , It's returns null. Here is follow code with error:

    string sServer = "MyServer";

    string sDataBase = "MyDatabaseName";

    string sUser = "MyUserName";

    string sPasswd = "MyPassWord"

    string _sProviderName = "MySql.Data.MySqlClient";
    _sConnection = "Persist Security Info=False;Server=" + sServer + ";Database=" + sDataBase + ";Uid=" + sUser +";Pwd=" + sPasswd + ";SslMode=none";

    DbProviderFactory factory = DbProviderFactories.GetFactory(""); DbDataAdapter da = factory.CreateDataAdapter(); //Here returns null for adapter and i get error in the next line when i try use dataadapter RetAdp.SelectCommand = Cmd; // here is where the error happen I google and saw others with the same error in the mysql bug site, and they talked this is a bug for .net framework .

    Anyone solved this bug ?

    Thanks for attention.

    Sunday, July 15, 2018 4:35 PM

All replies

  • Specify the provider invariant name as the GetFactory argument:

    DbProviderFactory factory = DbProviderFactories.GetFactory(_sProviderName);


    Dan Guzman, Data Platform MVP, http://www.dbdelta.com


    • Edited by Dan GuzmanMVP Sunday, July 15, 2018 4:53 PM
    • Proposed as answer by BonnieBMVP Sunday, July 15, 2018 11:23 PM
    Sunday, July 15, 2018 4:52 PM