예제 #1
0
        /// <summary>
        /// Insert a Value into option_values
        /// </summary>
        /// <param name="OptionValue">The default Value to insert</param>
        /// <param name="prompt">To prompt or not prompt for a user specified value</param>
        /// <param name="PromptOptionPathText">Option Path for the prompt</param>
        /// <param name="PromptOptionDescriptionText">Option Description for the prompt</param>
        /// <returns>The Index of the new value from the option_values table</returns>
        private int InsertValue(string OptionValue, bool prompt, string PromptOptionPathText, string PromptOptionDescriptionText)
        {
            string[] Sql      = new string[1];
            string   Sql2     = null;
            int      Value_ID = 0;

            DbDataReader Reader;

            try
            {
                Sql[0] = "INSERT INTO option_values (string) VALUES ('" + OptionValue + "')";
                Sql2   = "SELECT LAST_INSERT_ID() as value_id";
                Reader = _dsn.RunQueryNonQuery(Sql, Sql2);
                if (Reader.Read())
                {
                    Value_ID = Reader.GetInt32(0);
                }
                else
                {
                    Value_ID = 0;
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }

            return(Value_ID);
        }