I receive requests for recommendation many times, but I have received one from a student belonging at a previous affiliation of mine, asking for a favourable letter in view of their achievements.

I am aware of the fact that if I comment on the performance of the student, it could be used against me, since it is good practice to "erase" all the material, marks, personal information of the students and staff relationship at a previous job. So I am hesitant to go in that direction. On the other hand, I could comment only very generally on the skills of the student, which could backfire their application to a new job

Differently from this question I am not looking for a recommendation, but giving one...


Question: Fill: SelectCommand.Connection property has not been initialized. what to do?
Answer: I would recommend you use this pattern and remember that some of these objects are disposable.

public class CitiesService
{
    public DataSet DS;
    public OleDbConnection myConnection;
    public OleDbDataAdapter adapter;
    public OleDbDataAdapter adapter2;

    public CitiesService()
    {

    }



    public DataSet GetCities()
    {
        using (DataSet dataSet = new DataSet()) 
        {
            using (OleDbConnection myConnection = new OleDbConnection(ConnectionString))
            {           
                myConnection.Open();

                using (OleDbCommand myCmd = myConnection.CreateCommand())
                {
                    myCmd.CommandType = CommandType.StoredProcedure;
                    using (OleDbDataAdapter Adapter = new OleDbDataAdapter())
                    {
                        Adapter.SelectCommand = myCmd;
                        try
                        {

                            Adapter.Fill(dataSet, "tblCities");
                            dataSet.Tables["tblCities"].PrimaryKey = new DataColumn[] { dataSet.Tables["tblCities"].Columns["CityID"] };
                        }
                        catch (OleDbException ex)
                        {
                            throw ex;
                        }
                    }
                }
                myConnection.Close();
            }
            return dataSet;
        }
    }

}