|
|
|
start date: Fri, 17 Aug 2007 22:31:21 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Julien Sobrier
|
|
2
Masudur
|
|
3
Julien Sobrier
|
Problem with 2 SqlDataSource
Hello,
I have 2 SqlDataSource on the same page that retrieve the same column names:
<asp:SqlDataSource ID="SqlStructure" runat="server"
SelectCommand="SELECT a, b FROM c WHERE d = 0 />
<asp:SqlDataSource ID="SqlSons" runat="server"
SelectCommand="SELECT a, b FROM c WHERE d = 74" />
The problem is that Eval("a") always return the value from SqlStructure.
I tried to change the query to "SELECT a AS x, b AS Y FROM c WHERE d =
74" but Eval("Y") returns an error.
The ultimate goal is to have something like this:
<asp:SqlDataSource ID="SqlStructure" runat="server"
SelectCommand="SELECT a, b FROM c WHERE d = 0 />
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlStructure" />
<ItemTemplate>
<h2><%# Eval("b")%></h2>
<asp:SqlDataSource ID="SqlStructure" runat="server"
SelectCommand="SELECT a AS X, b AS Y FROM c WHERE d = <%#
Eval('a') %> />
<asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlSons" />
<ItemTemplate>
<p><%# Eval("b AS Y")%></p>
<ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
Thank you
Julien
Date:Fri, 17 Aug 2007 22:31:21 -0700
Author:
|
Re: Problem with 2 SqlDataSource
Hi...
.........
-> <asp:SqlDataSource ID="SqlStructure" runat="server"
SelectCommand="SELECT a AS X, b AS Y FROM c WHERE d = <%# Eva('a') />
-> <asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlSons" /
>
why the datasource id of the inner repeater is sqlSons... and in
sqldatasource it is said SqlStructure ?
Thanks
Masudur
Date:Sat, 18 Aug 2007 08:59:35 -0000
Author:
|
Re: Problem with 2 SqlDataSource
Masudur wrote:
> Hi...
> ........
> -> <asp:SqlDataSource ID="SqlStructure" runat="server"
> SelectCommand="SELECT a AS X, b AS Y FROM c WHERE d = <%# Eva('a') />
> -> <asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlSons" /
>
> why the datasource id of the inner repeater is sqlSons... and in
> sqldatasource it is said SqlStructure ?
>
>
> Thanks
> Masudur
>
I have 2 SqlDataSource (SqlStructure and SqlSons) which are both used:
<asp:SqlDataSource ID="SqlStructure" runat="server"
SelectCommand="SELECT a, b FROM c WHERE d = 0 />
<asp:SqlDataSource ID="SqlSons" runat="server"
SelectCommand="SELECT a, b FROM c WHERE d = 74" />
The problem is that Eval("a") always return the value from SqlStructure.
I tried to change the query to "SELECT a AS x, b AS Y FROM c WHERE d =
74" but Eval("Y") returns an error.
The ultimate goal is to have something like this:
<asp:SqlDataSource ID="SqlStructure" runat="server"
SelectCommand="SELECT a, b FROM c WHERE d = 0 />
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlStructure" />
<ItemTemplate>
<h2><%# Eval("b")%></h2>
<asp:SqlDataSource ID="SqlStructure" runat="server"
SelectCommand="SELECT a AS X, b AS Y FROM c WHERE d = <%#
Eval('a') %> />
<asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlSons" />
<ItemTemplate>
<p><%# Eval("b AS Y")%></p>
<ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
Date:Sat, 18 Aug 2007 09:07:21 -0700
Author:
|
|
|