hc1: I am trying to get a scalar value from a SELECT statement back into an ASP control on my web page. I tried:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"
SelectCommand="SELECT [Week], [Hours] FROM [WeekSummary] WHERE ([TaskGroup] = @TaskGroup);
SELECT @Team=[TeamName] FROM [TaskGroups] WHERE ([TaskGroup]=@TaskGroup)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="*" Name="TaskGroup" QueryStringField="TaskGroup" Type="String" />
<asp:ControlParameter ControlID="lblTeam" Name="Team" PropertyName="Text" Direction="Output" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
You will see that I am trying to fill an ASP Label in my web page. Is this the right way to go about doing it? Well, it didn't work for me. My lblTeam still retain its original value.
Thanks.
Hi hc1,
Base on my experience, you can use following line to solve your problem:
<asp:Label ID="BalanceLabel" runat="server" Text='<%# Eval("Balance") %>' />
Let me know if I have misunderstood what you mean. Thanks.
Hope it helps,
Hong Gang
Sincerely,
Hong Gang Chen
Microsoft Online Community Support
Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.