本文整理汇总了C#中System.Web.UI.WebControls.ControlParameter.ControlParameter构造函数的典型用法代码示例。如果您正苦于以下问题:C# ControlParameter构造函数的具体用法?C# ControlParameter怎么用?C# ControlParameter使用的例子?那么, 这里精选的构造函数代码示例或许可以为您提供帮助。
在下文中一共展示了ControlParameter构造函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button1_Click
private void Button1_Click(object sender, EventArgs e) {
// The user has pressed the Submit button, prepare a parameterized
// SQL query to insert the values from the controls.
AccessDataSource1.InsertCommand =
"INSERT INTO Employees (FirstName,LastName,Address,City,PostalCode,Country,ReportsTo) " +
" VALUES (?,?,?,?,?,?,? ); ";
AccessDataSource1.InsertParameters.Add(
new ControlParameter("FirstName", "TextBox1", "Text"));
AccessDataSource1.InsertParameters.Add(
new ControlParameter("LastName", "TextBox2", "Text"));
AccessDataSource1.InsertParameters.Add(
new ControlParameter("Address", "TextBox3", "Text"));
AccessDataSource1.InsertParameters.Add(
new ControlParameter("City", "TextBox4", "Text"));
AccessDataSource1.InsertParameters.Add(
new ControlParameter("PostalCode", "TextBox5", "Text"));
AccessDataSource1.InsertParameters.Add(
new ControlParameter("Country", "TextBox6", "Text"));
AccessDataSource1.InsertParameters.Add(
new ControlParameter("ReportsTo", "DropDownList1", "SelectedValue"));
try {
AccessDataSource1.Insert();
}
finally {
Button1.Visible = false;
Label9.Visible = true;
}
}
示例2: ControlParameter
ControlParameter country =
new ControlParameter("country",TypeCode.String,"ListBox1","SelectedValue");
sqlSource.SelectParameters.Add(country);
ControlParameter report =
new ControlParameter("report",TypeCode.Int16,"ListBox2","SelectedValue");
sqlSource.SelectParameters.Add(report);