FreakOut.classes.DatabaseConnector.GetPlatformID C# (CSharp) Method

GetPlatformID() public method

public GetPlatformID ( string PlatformName ) : int
PlatformName string
return int
        public int GetPlatformID(string PlatformName)
        {
            LogInstance.WriteToFile(1, "Trying to fetch the id of the platform " + PlatformName + ".", LogSource);
            if (!connectionopen)
            {
                DBConnector.Open();
                connectionopen = true;
            }
            FbTransaction DBTransaction = DBConnector.BeginTransaction();
            FbCommand DBCommand = new FbCommand("SELECT gamedbid FROM platforms WHERE name_of_platform='" + PlatformName + "'", DBConnector, DBTransaction);
            FbDataReader DBReader = DBCommand.ExecuteReader();
            int result = 0;
            while (DBReader.Read())
            {
                result = DBReader.GetInt32(0);
            }

            DBConnector.Close();
            connectionopen = false;
            return result;
        }