VS 2012和SelectParameter中的ASP.NET [英] VS 2012 and SelectParameter in asp .net
本文介绍了VS 2012和SelectParameter中的ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想在绑定的SelectCommand code文本字符串:
Hi I want to bind text string in SelectCommand code:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:finchsize_polibudaConnectionString %>"
SelectCommand="SELECT ocena FROM Oceny AS lista WHERE przedmiot = @ID"/>
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" DefaultValue="0" Name="ID"
PropertyName="Text" Type="String" />
</SelectParameters>
但我的VS 2012说:1.Validation(XHTML5):不支持元素SelectParameters。 2.元素ControlParameter'不是一个已知的元素。别宥知道如何解决这个问题,或者是绑定的SelectCommand中的一些文字任何其他方式?
But my VS 2012 said that: 1.Validation(XHTML5): Element SelectParameters is not supported. 2. Element 'ControlParameter' is not a known element. Do yuo know how to fix that, or is it any other way to bind some text in SelectCommand ?
P.S。我试过
<asp:QueryStringParameter />
很好,但它给了我完全同样的错误。
as well but it gives me exactly the same error.
推荐答案
的 SelectParameters
元素必须的子的SqlDataSource
。现在你拥有了它作为同行
The SelectParameters
element needs to be a child of SqlDataSource
. Right now you have it as a peer
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:finchsize_polibudaConnectionString %>"
SelectCommand="SELECT ocena FROM Oceny AS lista WHERE przedmiot = @ID">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" DefaultValue="0" Name="ID"
PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
这篇关于VS 2012和SelectParameter中的ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文