|
|
|
start date: Sat, 18 Aug 2007 11:58:43 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Julien Sobrier
|
|
2
Julien Sobrier
|
problem parameters in sqldatasource
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
Date:Sat, 18 Aug 2007 11:58:43 -0700
Author:
|
Re: problem parameters in sqldatasource
Julien Sobrier wrote:
> 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 @
Date:Sat, 18 Aug 2007 20:14:04 -0700
Author:
|
|
|