locked
Fail to generate TableAdapter : Object Reference not set to an instance of an object  RRS feed

  • Question

  • User-536468719 posted
    While generating the tableadapter in the configuration wizard, I got a warning :Object Reference not set to an instance of an object in the final step and fail to generate the tableadpater obviously.

    I use MYSQL database to connect the visual studio 2013 and it connected successfully when I configured the connection. The select statement also worked successfully in the wizard.

    Anyone can help?

    Thursday, November 22, 2018 2:55 PM

All replies

  • User1120430333 posted

    While generating the tableadapter in the configuration wizard, I got a warning :Object Reference not set to an instance of an object in the final step and fail to generate the tableadpater obviously.

    That's not a warning, a waning would not terminate the program. It's an exception error message and the program is being terminated. A class is instanced into an object that lives in memory. When code tries to access an object that has not been instanced that lives in memory, then you'll get the error message you are getting.

    You are using Mr. Wizard to do it for you that stunts your learning on how to do it yourself manually. And you don't know what Mr. Wizard has gone wrong. You should learn how to make the tableadpater manually yourself in code.

    https://stackoverflow.com/questions/18636973/initialise-table-adapter-manually

    https://dev.mysql.com/doc/dev/connector-net/8.0/html/T_MySql_Data_MySqlClient_MySqlDataAdapter.htm

    Thursday, November 22, 2018 5:15 PM
  • User1281381861 posted

    That error comes when you perform any operation on an object which is null.

    For example, suppose if you are doing obj.ToString() and if obj is null then that error will come, so please debug your code and debug it line by line and see where it is causing that error.

    Friday, November 23, 2018 5:28 AM