Exemplo n.º 1
0
        public void AddWithValue(string key, object value, bool check)
        {
            if (value == null)
            {
                value = DBNull.Value;
            }

            if (check && !SqlHelper.CheckSqlParameter(value.ToString()))
            {
                throw new SqlParameterException(key, value.ToString());
            }

            // Need to prevent adding a duplicate key
            int index = pm.IndexOf(key);

            if (index == -1)
            {
                pm.AddWithValue(key, value);
            }
            else
            {
                pm[index].Value = value;
            }
        }