problem parameters in sqldatasource

J

Julien Sobrier

Hello,
I'm facing a very simple problem. This DataSource returns the right result:
<asp:SqlDataSource ID="SqlSons" runat="server" EnableCaching=true
SelectCommand="SELECT no, titrefr FROM structure WHERE
parent= 74ORDER BY no DESC" />

But when I try to use an SalParameters, there is no result:
<asp:SqlDataSource ID="SqlSons" runat="server" EnableCaching=true
SelectCommand="SELECT no, titrefr FROM structure WHERE
parent= @Parent ORDER BY no DESC" >
<SelectParameters>
<asp:parameter Name="Parent" DefaultValue="74" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

Is there an additional step needed for the SqlDataSource to replace
@Parent by the DefaultValue of the Select Parameter Parent?


The "full" code is this:

<asp:SqlDataSource ID="SqlSons" runat="server" EnableCaching=true
SelectCommand="SELECT no, titrefr FROM structure WHERE
parent= @Parent ORDER BY no DESC" >
<SelectParameters>
<asp:parameter Name="Parent" DefaultValue="74" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

<ol>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlSons">
<ItemTemplate>
<li><%# Eval("titrefr") %></li>
</ItemTemplate>
</asp:Repeater>
</ol>

Thank you
Julien
 
J

Julien Sobrier

Julien said:
Hello,
I'm facing a very simple problem. This DataSource returns the right result:
<asp:SqlDataSource ID="SqlSons" runat="server" EnableCaching=true
SelectCommand="SELECT no, titrefr FROM structure WHERE
parent= 74ORDER BY no DESC" />

But when I try to use an SalParameters, there is no result:
<asp:SqlDataSource ID="SqlSons" runat="server" EnableCaching=true
SelectCommand="SELECT no, titrefr FROM structure WHERE
parent= @Parent ORDER BY no DESC" >
<SelectParameters>
<asp:parameter Name="Parent" DefaultValue="74" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

Is there an additional step needed for the SqlDataSource to replace
@Parent by the DefaultValue of the Select Parameter Parent?

I didn't realize that with MySQL, I need to use ? instead of @
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top