SqlDataSourceView.ParameterPrefix 属性
定义
获取用作参数化 SQL 查询中的参数占位符前缀的字符串。Gets the string that is used to prefix a parameter placeholder in a parameterized SQL query.
protected:
virtual property System::String ^ ParameterPrefix { System::String ^ get(); };
protected virtual string ParameterPrefix { get; }
member this.ParameterPrefix : string
Protected Overridable ReadOnly Property ParameterPrefix As String
属性值
“@”字符串。The "@" string.
注解
SQL 查询和命令可以参数化,因为它们包含在运行时绑定到查询的值的占位符。SQL queries and commands can be parameterized, in that they contain placeholders for values that are bound to the query at run time. 根据为控件设置的 ADO.NET 提供程序 SqlDataSource (由属性标识) ProviderName ,将按别名或按其在对象中的排序来计算参数 ParameterCollection 。Depending on the ADO.NET provider that is set for the SqlDataSource control, which is identified by the ProviderName property, the parameters are evaluated by alias or by their ordering in the ParameterCollection object.
如果 ProviderName 未设置或设置为,则将 System.Data.SqlClient 按别名计算参数,并 ParameterPrefix 使用属性将参数前缀添加到中 Name 每个对象的属性( Parameter 在 ParameterCollection 数据检索或数据操作操作过程中)。If the ProviderName is not set or is set to the System.Data.SqlClient, parameters are evaluated by alias and the ParameterPrefix property is used to add a parameter prefix to the Name property of each Parameter object in a ParameterCollection during a data retrieval or data manipulation operation. 如果将 ProviderName 属性设置为 System.Data.OleDb 或 System.Data.Odbc ,则按顺序计算参数,并 ParameterPrefix Name 忽略和属性。If the ProviderName property is set to the System.Data.OleDb or System.Data.Odbc, the parameters are evaluated by order and the ParameterPrefix and Name properties are ignored.
如果扩展了 SqlDataSourceView 类,则可以重写 ParameterPrefix 属性以提供除字符串以外的其他前缀 "@" (如果需要)。If you extend the SqlDataSourceView class, you can override the ParameterPrefix property to supply a prefix other than the "@" string, if required.