When I try to use the method GetCities(), it says:


  Fill: SelectCommand.Connection property has not been initialized.


Can anyone please advise on what to do?

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

    public CitiesService()
    {   
    }

    public DataSet GetCities()
    {
        OleDbCommand myCmd = new OleDbCommand("SPtblCities", myConnection);
        myCmd.CommandType = CommandType.StoredProcedure;
        OleDbDataAdapter Adapter = new OleDbDataAdapter();
        Adapter.SelectCommand = myCmd;
        DataSet dataSet = new DataSet();

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

        return dataSet;
    }

}



Question: If $f: \mathbb Q\to \mathbb Q$ is a homomorphism, prove that $f(x)=0$ for all $x\in\mathbb Q$ or $f(x)=x$ for all $x$ in $\mathbb Q$.
Answer: I understand that we're looking at rationals as a ring (as a group it is obviously false).

Pick an arbitrary homomorphism $\varphi:\mathbf Q\to \mathbf Q$. Put $e:=\varphi(1)$.

If $e=0$, then for any $x\in \mathbf Q$ we have $\varphi(x)=\varphi(1)\varphi(x)=0\cdot\varphi(x)=0$, so  $\varphi$ is zero.

If $e\neq 0$, then $e\cdot e=\varphi(1)\varphi(1)=\varphi(1\cdot 1)=e$, so $e=1$ (since $e\neq 0$ and $0,1$ are the only solutions of the equation $x^2-x=0$). Furthermore, for any $\frac{p}{q}$ we have $1+\ldots+1=p\cdot 1= p=\frac{p}{q}+\ldots \frac{p}{q}=q\cdot \frac{p}{q}$, so $e+\ldots +e=p\cdot e= q\cdot \varphi(\frac{p}{q})$, so $\varphi(\frac{p}{q})=e\cdot \frac{p}{q}=\frac{p}{q}$ and we're done (for negative $p$ we can use $\frac{p}{q}=(-1)\cdot \frac{-p}{q}$ so $\varphi(\frac{p}{q})=-e\cdot\varphi(\frac{-p}{q})=\frac{p}{q}$).