Wrote a small library to work with MySQL. Here I create class lib_ of type Library

main_form(void) { InitializeComponent(); // //TODO: добавьте код конструктора // lib_ = gcnew Library(); } 

In the Library constructor, I create the SqlConnector type

 Library::Library() { sql = gcnew SqlConnector(); } 

In the SqlConnector Constructor

 SqlConnector::SqlConnector() { Devart::Data::MySql::MySqlConnection^ sql_connection = gcnew Devart::Data::MySql::MySqlConnection(); Devart::Data::MySql::MySqlCommand^ sql_command = gcnew Devart::Data::MySql::MySqlCommand(); Devart::Data::MySql::MySqlDataAdapter^ sql_data_adapter = gcnew Devart::Data::MySql::MySqlDataAdapter(); Devart::Data::MySql::MySqlCommandBuilder^ sql_command_builder = gcnew Devart::Data::MySql::MySqlCommandBuilder(); } 

enter image description here

I leave the constructor and the pointers have nothing to indicate enter image description here

And accordingly, when I try to assign a value here, it gives an error enter image description here

Why it happens? How to solve a problem?

  • In the constructor, you have local variables declared. - Alexander Petrov
  • How obvious. Thanks, helped. - Artyom Maslov
  • How to close the question, do not tell me? - Artem Maslov

0