0
控件名为'ListOfPosts'的有效属性名称嗨我想创建一个SQL查询字符串的值的参数,但我不断收到一个错误说:PropertyName必须设置为ControlParameter'SubcategoryId'
属性名必须设置为命名控制的有效属性名ControlParameter“SubcategoryId”
我似乎无法理解的propertyName的应该be.Here是我的代码“ListOfPosts”:
<asp:SqlDataSource ID="ListOfPosts" runat="server"
ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [forum_posts].[PostTitle], [forum_posts].[PostContent], [forum_posts].[PostDate],
aspnet_Users.Username , forum_subcategories.SubCategoryName
FROM [forum_posts]
JOIN aspnet_Users ON [forum_posts].UserId = aspnet_Users.UserId
JOIN forum_subcategories on forum_posts.SubcategoryId = forum_subcategories.SubCategoryID
WHERE [forum_posts].SubcategoryId = @SubcategoryId">
<SelectParameters>
<asp:ControlParameter Name="SubcategoryId" ControlID="ListOfPosts" Type="String" DefaultValue='<%= Request.QueryString["post"] %>'/>
</SelectParameters>
</asp:SqlDataSource>