本文整理匯總了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);