/// <summary> /// Get or set command parameter. If a command parameter not found, /// a new parameter with the given field identifier is created and returned. /// </summary> /// <param name="fieldIdentifier">Field identifier without '@' as prefix.</param> /// <returns>Returns a command parameter associated with the field identifier. If not found, /// a new parameter with the given field identifier is created and returned.</returns> public DbParameter this[string fieldIdentifier] { get { if (_parameters.Contains("@" + fieldIdentifier)) { return(_parameters["@" + fieldIdentifier]); } else { DbParameter parameter = _command.CreateParameter(); parameter.ParameterName = "@" + fieldIdentifier; _parameters.Add(parameter); return(parameter); } } set { _parameters["@" + fieldIdentifier] = value; } }
//// <summary> ///// ���û�����Ϣ ///// </summary> ///// <param name="tableName"></param> ///// <param name="primaryKeyName"></param> //private void SetTableName(string tableName, string primaryKeyName) //{ //} // Todo: SearchManangerFunction �в�����������������ʱ�������� private static string GetParameterName(DbParameterCollection dbParams, string baseName) { baseName = baseName.Replace('(', '9').Replace(')', '9').Replace('*', '9'); if (dbParams == null || !dbParams.Contains(baseName)) { return baseName; } int i = 0; while (true) { string name = baseName + i.ToString(); if (!dbParams.Contains(name)) { return name; } i++; } }