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: Open Source Scripting Languages that work well with Microsoft SQL Server
Answer: Ruby on Rails / ActiveRecord has support for mssql, using the activerecord-sqlserver-adapter gem.