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

getNextOwnSystemIndex() private method

gets the next free system-id for user added systems
private getNextOwnSystemIndex ( ) : int
return int
        private int getNextOwnSystemIndex()
        {
            String      sqlString;
            Int32       currentSelfCreatedIndex;
            DataTable   Data;

            try
            {
                Data        = new DataTable();
                sqlString   = "select min(id) As min_id from tbSystems";

                Program.DBCon.Execute(sqlString, Data);

                if(Convert.IsDBNull(Data.Rows[0]["min_id"]))
                    currentSelfCreatedIndex = -1;
                else
                {
                    currentSelfCreatedIndex = ((Int32)Data.Rows[0]["min_id"]) - 1;
                    if(currentSelfCreatedIndex >= 0)
                        currentSelfCreatedIndex = -1;
                }

                return currentSelfCreatedIndex;
            }
            catch (Exception ex)
            {
                throw new Exception("Error while getting next free <own> system index", ex);
            }

        }