本文整理汇总了C#中System.Web.UI.WebControls.ParameterCollection类的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection类的具体用法?C# ParameterCollection怎么用?C# ParameterCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterCollection类属于System.Web.UI.WebControls命名空间,在下文中一共展示了ParameterCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:TestDataContext4.cs
示例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;
}
开发者ID:saif859,项目名称:MAPS,代码行数:43,代码来源:SQLDatabaseManager.cs
示例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;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:DataSourceHelper.cs
示例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);
}
开发者ID:nobled,项目名称:mono,代码行数:29,代码来源:DataSourceCacheManager.cs
示例6: WebControlParameterProxy
internal WebControlParameterProxy(Parameter parameter, ParameterCollection parameterCollection, EntityDataSource entityDataSource)
{
Debug.Assert(null != entityDataSource);
_parameter = parameter;
_collection = parameterCollection;
_entityDataSource = entityDataSource;
VerifyUniqueType(_parameter);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:WebControlParameterProxy.cs
示例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);
}
开发者ID:saif859,项目名称:MAPS,代码行数:9,代码来源:FieldAreaViewMethof.cs
示例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);
}
}
开发者ID:t1b1c,项目名称:lwas,代码行数:13,代码来源:SqlDataSourceConfigurationParser.cs
示例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;
}
开发者ID:nobled,项目名称:mono,代码行数:13,代码来源:EmployeesDataContext.cs
示例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;
}
开发者ID:nobled,项目名称:mono,代码行数:13,代码来源:TestDataContext3.cs
示例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;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:36,代码来源:EntityDataSourceStatementEditorForm.cs
示例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;
}
}
开发者ID:webgrid,项目名称:WebGrid,代码行数:21,代码来源:Data+Interface.cs
示例14: GetTableData
public IList GetTableData (string tableName, DataSourceSelectArguments args, string where, ParameterCollection whereParams)
{
return null;
}
开发者ID:nobled,项目名称:mono,代码行数:4,代码来源:TestDataContext2.cs
示例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);
}
}
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:58,代码来源:SqlDataSourceView.cs
示例16: RaiseAjaxPostBackEvent
public void RaiseAjaxPostBackEvent(string eventArgument, ParameterCollection extraParams)
{
bool success = true;
string message = null;
object value = null;
try
{
if (eventArgument.IsEmpty())
{
throw new ArgumentNullException("eventArgument");
}
string data = null;
if (this.DirectConfig != null)
{
JToken serviceToken = this.DirectConfig.SelectToken("config.serviceParams");
if (serviceToken != null)
{
data = JSON.ToString(serviceToken);
}
}
switch (eventArgument)
{
case "remotevalidation":
RemoteValidationEventArgs e = new RemoteValidationEventArgs(data, extraParams);
this.RemoteValidation.OnValidation(e);
success = e.Success;
message = e.ErrorMessage;
if (e.ValueIsChanged)
{
value = e.Value;
}
break;
}
}
catch (Exception ex)
{
success = false;
message = this.IsDebugging ? ex.ToString() : ex.Message;
if (this.ResourceManager.RethrowAjaxExceptions)
{
throw;
}
}
ResourceManager.ServiceResponse = new { valid=success, message, value };
}
开发者ID:rajjan,项目名称:Ext.NET.Community,代码行数:52,代码来源:Field.cs
示例17: OnOkButtonClick
private void OnOkButtonClick(object sender, EventArgs e)
{
ICollection dataSource = (ICollection) this._parametersDataGridView.DataSource;
ParameterCollection parameters = new ParameterCollection();
foreach (ParameterItem item in dataSource)
{
if (item.DbType == DbType.Object)
{
parameters.Add(new Parameter(item.Name, item.Type, item.DefaultValue));
}
else
{
parameters.Add(new Parameter(item.Name, item.DbType, item.DefaultValue));
}
}
if (this._sqlDataSourceDesigner.RefreshSchema(new DesignerDataConnection(string.Empty, this._providerName, this._connectionString), this._selectCommand, this._selectCommandType, parameters, false))
{
base.DialogResult = DialogResult.OK;
base.Close();
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:SqlDataSourceRefreshSchemaForm.cs
示例18: SetOwnerCollection
internal void SetOwnerCollection (ParameterCollection own)
{
_owner = own;
}
开发者ID:nobled,项目名称:mono,代码行数:4,代码来源:Parameter.cs
示例19: SetOwner
internal void SetOwner(ParameterCollection owner)
{
this._owner = owner;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:Parameter.cs
示例20: InitializeParameters
void InitializeParameters (DbCommand command, ParameterCollection parameters, IDictionary values, IDictionary oldValues, bool parametersMayMatchOldValues)
{
IOrderedDictionary parameterValues = parameters.GetValues (context, owner);
foreach (string parameterName in parameterValues.Keys) {
Parameter p = parameters [parameterName];
object value = FindValueByName (parameterName, values, false);
string valueName = parameterName;
if (value == null)
value = FindValueByName (parameterName, oldValues, true);
if (value == null && parametersMayMatchOldValues) {
value = FindValueByName (parameterName, oldValues, false);
valueName = FormatOldParameter (parameterName);
}
if (value != null) {
object dbValue = p.ConvertValue (value);
DbParameter newParameter = CreateDbParameter (valueName, dbValue, p.Direction, p.Size);
if (!command.Parameters.Contains (newParameter.ParameterName)) {
command.Parameters.Add (newParameter);
}
}
else {
command.Parameters.Add (CreateDbParameter (p.Name, parameterValues [parameterName], p.Direction, p.Size));
}
}
if (values != null) {
foreach (DictionaryEntry de in values)
if (!command.Parameters.Contains (ParameterPrefix + (string) de.Key))
command.Parameters.Add (CreateDbParameter ((string) de.Key, de.Value));
}
if (oldValues != null) {
foreach (DictionaryEntry de in oldValues)
if (!command.Parameters.Contains (ParameterPrefix + FormatOldParameter ((string) de.Key)))
command.Parameters.Add (CreateDbParameter (FormatOldParameter ((string) de.Key), de.Value));
}
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:40,代码来源:SqlDataSourceView.cs
注:本文中的System.Web.UI.WebControls.ParameterCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论