The ConnectionString property was not initialized

2

I'm trying to create a category registry, in the registry everything went fine, but when I go to make the location of the records added to the registry always returns the same error:

  An unhandled exception of type 'System.InvalidOperationException'   occurred in System.Data.dll

     

"The ConnectionString property has not been initialized."

As shown in the image below:

I'm waiting for answers

    
asked by anonymous 09.03.2017 / 14:26

1 answer

1

The connection object you are passing in the SqlDataAdapter parameter has not been instantiated.

Try the following:

public DataTable Localizar(String Valor)
{
    DataTable tabela = new DataTable();
    conexao = new DALConexao();
    ....
}

or check the registration method as you instantiated the connection object.

    
09.03.2017 / 14:51