本文整理汇总了C#中System.Web.UI.WebControls.ParameterCollection类的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection类的具体用法?C# ParameterCollection怎么用?C# ParameterCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterCollection类属于System.Web.UI.WebControls命名空间,在下文中一共展示了ParameterCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlDataSourceRefreshSchemaForm
public SqlDataSourceRefreshSchemaForm(IServiceProvider serviceProvider, SqlDataSourceDesigner sqlDataSourceDesigner, ParameterCollection parameters) : base(serviceProvider)
{
this._sqlDataSourceDesigner = sqlDataSourceDesigner;
this._sqlDataSource = (SqlDataSource) this._sqlDataSourceDesigner.Component;
this._connectionString = this._sqlDataSourceDesigner.ConnectionString;
this._providerName = this._sqlDataSourceDesigner.ProviderName;
this._selectCommand = this._sqlDataSourceDesigner.SelectCommand;
this._selectCommandType = this._sqlDataSource.SelectCommandType;
this.InitializeComponent();
this.InitializeUI();
Array values = Enum.GetValues(typeof(TypeCode));
Array.Sort(values, new TypeCodeComparer());
foreach (TypeCode code in values)
{
((DataGridViewComboBoxColumn) this._parametersDataGridView.Columns[1]).Items.Add(code);
}
Array array = Enum.GetValues(typeof(DbType));
Array.Sort(array, new DbTypeComparer());
foreach (DbType type in array)
{
((DataGridViewComboBoxColumn) this._parametersDataGridView.Columns[2]).Items.Add(type);
}
ArrayList list = new ArrayList(parameters.Count);
foreach (Parameter parameter in parameters)
{
list.Add(new ParameterItem(parameter));
}
this._parametersDataGridView.DataSource = list;
this._commandTextBox.Text = this._selectCommand;
this._commandTextBox.Select(0, 0);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:SqlDataSourceRefreshSchemaForm.cs
示例2: GetTableData
public IList GetTableData (string tableName, DataSourceSelectArguments args, string where, ParameterCollection whereParams)
{
if (String.Compare (tableName, "BazValidationAttributesTable", StringComparison.OrdinalIgnoreCase) == 0)
return BazValidationAttributes;
return null;
}
示例3: ExecuteDataReader
/// <summary>
/// This function takes in the query that needs to be executed and returns a data reader as output
/// </summary>
/// <param name="Conn">The SQL Connection to be used</param>
/// <param name="CommType">The Command type whether it is stored procedure or a simple query</param>
/// <param name="CommString">If Stored procedure, then the name of the stored procedure, if simple query, then the query in
/// string format</param>
/// <param name="Parameters">List of parameters, if any required for Stored procedure</param>
/// <returns>SQL Data reader that is the output of the select query executed</returns>
public static SqlDataReader ExecuteDataReader(SqlConnection Conn, CommandType CommType, string CommString, ParameterCollection Parameters)
{
SqlDataReader return_sdr = null;
try
{
SqlCommand comm = new SqlCommand(CommString, Conn);
comm.CommandType = CommType;
if (Parameters != null && Parameters.Count > 0)
{
foreach (Parameter param in Parameters)
{
if (param.DefaultValue == "")
comm.Parameters.AddWithValue(param.Name, DBNull.Value);
else
comm.Parameters.AddWithValue(param.Name, param.DefaultValue);
}
}
if (Conn.State != ConnectionState.Open)
{
Conn.Open();
}
return_sdr = comm.ExecuteReader();
}
catch (SqlException sqx)
{
throw new Exception("SQLException : " + sqx.ErrorCode + Environment.NewLine + "Line Number : " + sqx.LineNumber + " Message : " + sqx.Message + Environment.NewLine + "Stack Trace :" + Environment.NewLine + sqx.StackTrace);
}
catch (Exception exp)
{
throw new Exception("Exception : " + exp.InnerException + Environment.NewLine + " Message : " + exp.Message + Environment.NewLine + "Stack Trace :" + Environment.NewLine + exp.StackTrace);
}
return return_sdr;
}
示例4: MergeDictionaries
public static bool MergeDictionaries(object dataObjectType, ParameterCollection reference, IDictionary source,
IDictionary destination, IDictionary destinationCopy, IDictionary<string, Exception> validationErrors) {
if (source != null) {
foreach (DictionaryEntry de in source) {
object value = de.Value;
// search for a parameter that corresponds to this dictionary entry.
Parameter referenceParameter = null;
string parameterName = (string)de.Key;
foreach (Parameter p in reference) {
if (String.Equals(p.Name, parameterName, StringComparison.OrdinalIgnoreCase)) {
referenceParameter = p;
break;
}
}
// use the parameter for type conversion, default value and/or converting empty string to null.
if (referenceParameter != null) {
try {
value = referenceParameter.GetValue(value, true);
}
catch (Exception e) {
// catch conversion exceptions so they can be handled. Note that conversion throws various
// types of exceptions like InvalidCastException, FormatException, OverflowException, etc.
validationErrors[referenceParameter.Name] = e;
}
}
// save the value to the merged dictionaries.
destination[parameterName] = value;
if (destinationCopy != null) {
destinationCopy[parameterName] = value;
}
}
}
return validationErrors.Count == 0;
}
示例5: SetCachedObject
internal void SetCachedObject (string methodName, ParameterCollection parameters, object o)
{
if (o == null)
return;
string key = GetKeyFromParameters (methodName, parameters);
if (DataCache [key] != null)
DataCache.Remove (key);
DateTime absoluteExpiration = Cache.NoAbsoluteExpiration;
TimeSpan slidindExpiraion = Cache.NoSlidingExpiration;
if (cacheDuration > 0) {
if (cacheExpirationPolicy == DataSourceCacheExpiry.Absolute)
absoluteExpiration = DateTime.Now.AddSeconds (cacheDuration);
else
slidindExpiraion = new TimeSpan (0, 0, cacheDuration);
}
string [] dependencies;
if (cacheKeyDependency.Length > 0)
dependencies = new string [] { cacheKeyDependency };
else
dependencies = new string [] { };
DataCache.Add (key, o, new CacheDependency (new string [] { }, dependencies),
absoluteExpiration, slidindExpiraion, CacheItemPriority.Default, null);
}
示例6: WebControlParameterProxy
internal WebControlParameterProxy(Parameter parameter, ParameterCollection parameterCollection, EntityDataSource entityDataSource)
{
Debug.Assert(null != entityDataSource);
_parameter = parameter;
_collection = parameterCollection;
_entityDataSource = entityDataSource;
VerifyUniqueType(_parameter);
}
示例7: getfieldAreaTopValue
public static DataSet getfieldAreaTopValue(int id)
{
string sql = "GetFieldAreaTopValue";
ParameterCollection par = new ParameterCollection();
par.Add("@Id", id.ToString());
return SQLDatabaseManager.ExecuteDataSet1(sql, par);
}
示例8: BuildCommand
private void BuildCommand(IConfigurationElement parametersSection, ParameterCollection parameters)
{
parameters.Clear();
foreach (IConfigurationElement parameterElement in parametersSection.Elements.Values)
{
Parameter commandParameter = new Parameter();
foreach (IConfigurationElement propertyElement in parameterElement.Elements.Values)
{
ReflectionServices.SetValue(commandParameter, propertyElement.GetAttributeReference("name").Value.ToString(), propertyElement.GetAttributeReference("value").Value);
}
parameters.Add(commandParameter);
}
}
示例9: GetTableData
public IList GetTableData (string tableName, DataSourceSelectArguments args, string where, ParameterCollection whereParams)
{
if (String.Compare (tableName, "EmployeeTable", StringComparison.OrdinalIgnoreCase) == 0)
return Employees;
if (String.Compare (tableName, "SeasonalEmployeeTable", StringComparison.OrdinalIgnoreCase) == 0)
return SeasonalEmployees;
if (String.Compare (tableName, "BazDataTypeDefaultTypesTable", StringComparison.OrdinalIgnoreCase) == 0)
return DefaultDataTypes;
return null;
}
示例10: GetTableData
public IList GetTableData (string tableName, DataSourceSelectArguments args, string where, ParameterCollection whereParams)
{
if (String.Compare (tableName, "AssociatedFooTable", StringComparison.OrdinalIgnoreCase) == 0)
return AssociatedFoo;
if (String.Compare (tableName, "AssociatedBarTable", StringComparison.OrdinalIgnoreCase) == 0)
return AssociatedBar;
if (String.Compare (tableName, "BazWithDataTypeAttributeTable", StringComparison.OrdinalIgnoreCase) == 0)
return BazWithDataTypeAttribute;
return null;
}
示例11: SqlDataSourceParameterValueEditorForm
public SqlDataSourceParameterValueEditorForm(IServiceProvider serviceProvider, ParameterCollection parameters) : base(serviceProvider)
{
this._parameterItems = new ArrayList();
foreach (Parameter parameter in parameters)
{
this._parameterItems.Add(new ParameterItem(parameter));
}
this.InitializeComponent();
this.InitializeUI();
string[] names = Enum.GetNames(typeof(TypeCode));
Array.Sort<string>(names);
((DataGridViewComboBoxColumn) this._parametersDataGridView.Columns[1]).Items.AddRange(names);
string[] array = Enum.GetNames(typeof(DbType));
Array.Sort<string>(array);
((DataGridViewComboBoxColumn) this._parametersDataGridView.Columns[2]).Items.AddRange(array);
this._parametersDataGridView.DataSource = this._parameterItems;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:SqlDataSourceParameterValueEditorForm.cs
示例12: EntityDataSourceStatementEditorForm
public EntityDataSourceStatementEditorForm(System.Web.UI.Control entityDataSource, IServiceProvider serviceProvider,
bool hasAutoGen, bool isAutoGen, string propertyName, string statementLabelText, string statementAccessibleName,
string helpTopic, string statement, ParameterCollection parameters)
: base(serviceProvider)
{
_entityDataSource = entityDataSource;
InitializeComponent();
InitializeUI(propertyName, statementLabelText, statementAccessibleName);
InitializeTabIndexes();
InitializeAnchors();
_helpTopic = helpTopic;
if (!hasAutoGen)
{
HideCheckBox();
}
_parameters = parameters;
_autoGenerateCheckBox.Checked = isAutoGen;
_statementPanel.Enabled = !isAutoGen;
_statementTextBox.Text = statement;
_statementTextBox.Select(0, 0);
List<Parameter> paramList = new List<Parameter>();
foreach (Parameter p in parameters)
{
paramList.Add(p);
}
_parameterEditorUserControl.AddParameters(paramList.ToArray());
_cachedStatementText = null;
}
示例13: ApplyParameterCollection
private static void ApplyParameterCollection(Row row, ParameterCollection parameters, string prefix)
{
if (string.IsNullOrEmpty(prefix))
prefix = "{0}";
foreach (RowCell cell in row.Cells)
{
string value = null;
if (cell.Value != null)
value = cell.Value.ToString();
if (parameters[cell.CellId] == null)
parameters.Add(cell.CellId, row.Columns[cell.CellId].DataType, value);
else
parameters[cell.CellId].DefaultValue = value;
if (parameters[String.Format("@" + prefix, cell.CellId)] == null)
parameters.Add(String.Format("@" + prefix, cell.CellId), row.Columns[cell.CellId].DataType, value);
else
parameters[String.Format("@" + prefix, cell.CellId)].DefaultValue = value;
}
}
示例14: GetTableData
public IList GetTableData (string tableName, DataSourceSelectArguments args, string where, ParameterCollection whereParams)
{
return null;
}
示例15: AddParameters
/// <devdoc>
/// Adds parameters to an DbCommand from an IOrderedDictionary.
/// The exclusion list contains parameter names that should not be added
/// to the command's parameter collection.
/// </devdoc>
private void AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, string oldValuesParameterFormatString) {
Debug.Assert(command != null);
IDictionary caseInsensitiveExclusionList = null;
if (exclusionList != null) {
caseInsensitiveExclusionList = new ListDictionary(StringComparer.OrdinalIgnoreCase);
foreach (DictionaryEntry de in exclusionList) {
caseInsensitiveExclusionList.Add(de.Key, de.Value);
}
}
if (parameters != null) {
string parameterPrefix = ParameterPrefix;
foreach (DictionaryEntry de in parameters) {
string rawParamName = (string)de.Key;
if ((caseInsensitiveExclusionList != null) && (caseInsensitiveExclusionList.Contains(rawParamName))) {
// If we have an exclusion list and it contains this parameter, skip it
continue;
}
string formattedParamName;
if (oldValuesParameterFormatString == null) {
formattedParamName = rawParamName;
}
else {
formattedParamName = String.Format(CultureInfo.InvariantCulture, oldValuesParameterFormatString, rawParamName);
}
object value = de.Value;
// If the reference collection contains this parameter, we will use
// the Parameter's settings to format the value
Parameter parameter = reference[formattedParamName];
if (parameter != null) {
value = parameter.GetValue(de.Value, false);
}
formattedParamName = parameterPrefix + formattedParamName;
if (command.Parameters.Contains(formattedParamName)) {
// We never overwrite an existing value with a null value
if (value != null) {
command.Parameters[formattedParamName].Value = value;
}
}
else {
// Parameter does not exist, add a new one
DbParameter dbParameter = _owner.CreateParameter(formattedParamName, value);
command.Parameters.Add(dbParameter);
}
}
}
}