本文整理汇总了C#中System.Web.UI.WebControls.ParameterCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection.Add方法的具体用法?C# ParameterCollection.Add怎么用?C# ParameterCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.ParameterCollection
的用法示例。
在下文中一共展示了ParameterCollection.Add方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getfieldAreaTopValue
public static DataSet getfieldAreaTopValue(int id)
{
string sql = "GetFieldAreaTopValue";
ParameterCollection par = new ParameterCollection();
par.Add("@Id", id.ToString());
return SQLDatabaseManager.ExecuteDataSet1(sql, par);
}
示例2: 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);
}
}
示例3: SearchButton1_Click
/// <summary>
/// myself:不用异常处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchButton1_Click(object sender, EventArgs e)
{
//try
//{
if (SearchByXH.Text != "")
{
querry += "and [XH]= @XH";
}
if (SearchByNickName.Text != "")
{
querry += "and [User_NickName][email protected]";
}
if (SearchByName.Text != "")
{
querry += "and [XM][email protected]";
}
if (SearchByQQ.Text != "")
{
querry += "and [User_QQ][email protected]";
}
if (DropXY.SelectedValue != null)
{
querry += "and [YXSMC][email protected]";
}
if (DropZY.SelectedValue != null)
{
querry += "and [ZYMC][email protected]";
}
//}
//catch
//{
// Context.Response.Write("<script>alert('出错了!')</script>");
//}
ParameterCollection co = new ParameterCollection();
co.Add("@XH", SearchByXH.Text);
co.Add("@UNN", SearchByNickName.Text);
co.Add("@XM", SearchByName.Text);
co.Add("@UQ", SearchByQQ.Text);
co.Add("@XY", DropXY.SelectedValue);
co.Add("@ZY", DropZY.SelectedValue);
Source1.SelectCommand = querry;
Repeater1.DataSource = Source1;
Repeater1.DataBind();
}
示例4: 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;
}
}
示例5: 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
示例6: SetParameters
private void SetParameters(ParameterCollection original, ParameterCollection newParams)
{
original.Clear();
foreach (Parameter parameter in newParams)
{
original.Add(parameter);
}
}
示例7: CloneParameters
internal void CloneParameters(ParameterCollection originalParameters, ParameterCollection newParameters)
{
foreach (ICloneable parameter in originalParameters)
{
Parameter clone = (Parameter)parameter.Clone();
RegisterClone(parameter, clone);
newParameters.Add(clone);
}
}
示例8: MoveParameters
private static void MoveParameters(ParameterCollection source, ParameterCollection target)
{
foreach (Parameter p in source)
{
target.Add(p);
}
source.Clear();
}
示例9: OnOkButtonClick
private void OnOkButtonClick(object sender, EventArgs e)
{
ParameterCollection parameters = new ParameterCollection();
foreach (ParameterItem item in this._parameterItems)
{
if (item.Parameter.DbType == DbType.Object)
{
parameters.Add(new Parameter(item.Parameter.Name, item.Parameter.Type, item.Parameter.DefaultValue));
}
else
{
parameters.Add(new Parameter(item.Parameter.Name, item.Parameter.DbType, item.Parameter.DefaultValue));
}
}
try
{
parameters.GetValues(null, null);
}
catch (Exception exception)
{
UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("SqlDataSourceParameterValueEditorForm_InvalidParameter"));
return;
}
base.DialogResult = DialogResult.OK;
base.Close();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:SqlDataSourceParameterValueEditorForm.cs
示例10: MergeParameters
internal static void MergeParameters(ParameterCollection parameters, MethodInfo methodInfo, System.Type dataObjectType)
{
Parameter[] parameterArray = new Parameter[parameters.Count];
parameters.CopyTo(parameterArray, 0);
parameters.Clear();
if ((methodInfo != null) && (dataObjectType == null))
{
foreach (ParameterInfo info in methodInfo.GetParameters())
{
Parameter parameter = CreateMergedParameter(info, parameterArray);
if (parameters[parameter.Name] == null)
{
parameters.Add(parameter);
}
}
}
}
示例11: RefreshSchema
public override void RefreshSchema(bool preferSilent)
{
try
{
this.SuppressDataSourceEvents();
bool flag = false;
IServiceProvider site = this.SqlDataSource.Site;
if (!this.CanRefreshSchema)
{
if (!preferSilent)
{
UIServiceHelper.ShowError(site, System.Design.SR.GetString("SqlDataSourceDesigner_RefreshSchemaRequiresSettings"));
}
}
else
{
IDataSourceViewSchema schema = this.GetView("DefaultView").Schema;
bool flag2 = false;
if (schema == null)
{
this._forceSchemaRetrieval = true;
schema = this.GetView("DefaultView").Schema;
this._forceSchemaRetrieval = false;
flag2 = true;
}
DesignerDataConnection connection = new DesignerDataConnection(string.Empty, this.ProviderName, this.ConnectionString);
if (preferSilent)
{
flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, this.SqlDataSource.SelectParameters, true);
}
else
{
Parameter[] parameterArray = this.InferParameterNames(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType);
if (parameterArray == null)
{
return;
}
ParameterCollection parameters = new ParameterCollection();
ParameterCollection parameters2 = new ParameterCollection();
foreach (ICloneable cloneable in this.SqlDataSource.SelectParameters)
{
parameters2.Add((Parameter) cloneable.Clone());
}
foreach (Parameter parameter in parameterArray)
{
if ((parameter.Direction == ParameterDirection.Input) || (parameter.Direction == ParameterDirection.InputOutput))
{
Parameter parameter2 = parameters2[parameter.Name];
if (parameter2 != null)
{
parameter.DefaultValue = parameter2.DefaultValue;
if ((parameter.DbType == DbType.Object) && (parameter.Type == TypeCode.Empty))
{
parameter.DbType = parameter2.DbType;
parameter.Type = parameter2.Type;
}
parameters2.Remove(parameter2);
}
parameters.Add(parameter);
}
}
if (parameters.Count > 0)
{
SqlDataSourceRefreshSchemaForm form = new SqlDataSourceRefreshSchemaForm(site, this, parameters);
flag = UIServiceHelper.ShowDialog(site, form) == DialogResult.OK;
}
else
{
flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, parameters, false);
}
}
if (flag)
{
IDataSourceViewSchema schema2 = this.GetView("DefaultView").Schema;
if (flag2 && DataSourceDesigner.ViewSchemasEquivalent(schema, schema2))
{
this.OnDataSourceChanged(EventArgs.Empty);
}
else if (!DataSourceDesigner.ViewSchemasEquivalent(schema, schema2))
{
this.OnSchemaRefreshed(EventArgs.Empty);
}
}
}
}
finally
{
this.ResumeDataSourceEvents();
}
}
示例12: OnTestQueryButtonClick
private void OnTestQueryButtonClick(object sender, EventArgs e)
{
ParameterCollection parameters = new ParameterCollection();
foreach (Parameter parameter in this._selectQuery.Parameters)
{
if (parameter.DbType == DbType.Object)
{
parameters.Add(new Parameter(parameter.Name, parameter.Type, parameter.DefaultValue));
}
else
{
parameters.Add(new Parameter(parameter.Name, parameter.DbType, parameter.DefaultValue));
}
}
if (parameters.Count > 0)
{
SqlDataSourceParameterValueEditorForm form = new SqlDataSourceParameterValueEditorForm(base.ServiceProvider, parameters);
if (UIServiceHelper.ShowDialog(base.ServiceProvider, form) == DialogResult.Cancel)
{
return;
}
}
this._resultsGridView.DataSource = null;
DbCommand command = null;
Cursor current = Cursor.Current;
try
{
Cursor.Current = Cursors.WaitCursor;
DbProviderFactory dbProviderFactory = SqlDataSourceDesigner.GetDbProviderFactory(this._dataConnection.ProviderName);
DbConnection designTimeConnection = null;
try
{
designTimeConnection = SqlDataSourceDesigner.GetDesignTimeConnection(base.ServiceProvider, this._dataConnection);
}
catch (Exception exception)
{
if (designTimeConnection == null)
{
UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("SqlDataSourceSummaryPanel_CouldNotCreateConnection"));
return;
}
}
if (designTimeConnection == null)
{
UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("SqlDataSourceSummaryPanel_CouldNotCreateConnection"));
}
else
{
command = this._sqlDataSourceDesigner.BuildSelectCommand(dbProviderFactory, designTimeConnection, this._selectQuery.Command, parameters, this._selectQuery.CommandType);
DbDataAdapter adapter = SqlDataSourceDesigner.CreateDataAdapter(dbProviderFactory, command);
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
if (dataSet.Tables.Count == 0)
{
UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("SqlDataSourceSummaryPanel_CannotExecuteQueryNoTables"));
}
else
{
this._resultsGridView.DataSource = dataSet.Tables[0];
foreach (DataGridViewColumn column in this._resultsGridView.Columns)
{
column.SortMode = DataGridViewColumnSortMode.NotSortable;
}
this._resultsGridView.AutoResizeColumnHeadersHeight();
this._resultsGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
}
}
}
catch (Exception exception2)
{
UIServiceHelper.ShowError(base.ServiceProvider, exception2, System.Design.SR.GetString("SqlDataSourceSummaryPanel_CannotExecuteQuery"));
}
finally
{
if ((command != null) && (command.Connection.State == ConnectionState.Open))
{
command.Connection.Close();
}
Cursor.Current = current;
}
}
示例13: OnComplete
protected internal override void OnComplete()
{
PropertyDescriptor descriptor;
SqlDataSource component = (SqlDataSource) this._sqlDataSourceDesigner.Component;
if (component.DeleteCommand != this._deleteQuery.Command)
{
descriptor = TypeDescriptor.GetProperties(component)["DeleteCommand"];
descriptor.SetValue(component, this._deleteQuery.Command);
}
if (component.DeleteCommandType != this._deleteQuery.CommandType)
{
descriptor = TypeDescriptor.GetProperties(component)["DeleteCommandType"];
descriptor.SetValue(component, this._deleteQuery.CommandType);
}
if (component.InsertCommand != this._insertQuery.Command)
{
descriptor = TypeDescriptor.GetProperties(component)["InsertCommand"];
descriptor.SetValue(component, this._insertQuery.Command);
}
if (component.InsertCommandType != this._insertQuery.CommandType)
{
descriptor = TypeDescriptor.GetProperties(component)["InsertCommandType"];
descriptor.SetValue(component, this._insertQuery.CommandType);
}
if (component.SelectCommand != this._selectQuery.Command)
{
descriptor = TypeDescriptor.GetProperties(component)["SelectCommand"];
descriptor.SetValue(component, this._selectQuery.Command);
}
if (component.SelectCommandType != this._selectQuery.CommandType)
{
descriptor = TypeDescriptor.GetProperties(component)["SelectCommandType"];
descriptor.SetValue(component, this._selectQuery.CommandType);
}
if (component.UpdateCommand != this._updateQuery.Command)
{
descriptor = TypeDescriptor.GetProperties(component)["UpdateCommand"];
descriptor.SetValue(component, this._updateQuery.Command);
}
if (component.UpdateCommandType != this._updateQuery.CommandType)
{
TypeDescriptor.GetProperties(component)["UpdateCommandType"].SetValue(component, this._updateQuery.CommandType);
}
this._sqlDataSourceDesigner.CopyList(this._selectQuery.Parameters, component.SelectParameters);
this._sqlDataSourceDesigner.CopyList(this._insertQuery.Parameters, component.InsertParameters);
this._sqlDataSourceDesigner.CopyList(this._updateQuery.Parameters, component.UpdateParameters);
this._sqlDataSourceDesigner.CopyList(this._deleteQuery.Parameters, component.DeleteParameters);
ParameterCollection parameters = new ParameterCollection();
foreach (Parameter parameter in this._selectQuery.Parameters)
{
parameters.Add(parameter);
}
this._sqlDataSourceDesigner.RefreshSchema(this._dataConnection, this._selectQuery.Command, this._selectQuery.CommandType, parameters, true);
}