IBE.SQL.EliteDBIO.getStations C# (CSharp) Method

getStations() public method

retrieves all stationnames in the system in a array
public getStations ( string System ) : string[]
System string
return string[]
        public string[] getStations(string System)
        {
            String sqlString;
            DataTable Data;
            String[] retValue = new String[0];
            Int32 RowCounter;

            try
            {
                Data = new DataTable();
                
                sqlString = "select St.Stationname from tbSystems Sy, tbStations St" +
                            " where Sy.ID         = St.System_ID" +
                            " and   Sy.Systemname = " + DBConnector.SQLAString(DBConnector.SQLEscape(System));

                Program.DBCon.Execute(sqlString, Data);

                Array.Resize(ref retValue, Data.Rows.Count);
                RowCounter = 0;

                foreach (DataRow currentRow in Data.Rows)
                {
                    retValue[RowCounter] = (String)currentRow["Stationname"];
                    RowCounter++;
                }

                return retValue;
            }
            catch (Exception ex)
            {
                throw new Exception("Error while getting names of stations in a system", ex);
            }
        }