CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > visual_studio.visual_web_developer_2008_express Tags:
Item Type: Date Entered: 2/21/2008 12:39:49 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 3 Views: 40 Favorited: 0 Favorite
4 Items, 1 Pages 1 |< << Go >> >|
"hc1" <>
NewsGroup User
Return Value To Web Page2/21/2008 12:39:49 PM

0

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.

 

"Hong-Gang Chen
NewsGroup User
Re: Return Value To Web Page2/25/2008 7:03:18 AM

0

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.
"hc1" <>
NewsGroup User
Re: Return Value To Web Page2/25/2008 3:49:49 PM

0

Hong Gang, thanks for answering.

What I am trying to do is to capture the result from a SQL query statement.  Web Developer allows a parameter to be Input or Output.  How do I make use of the Output capability?  How do I transfer a value from the SQlDataSource object back to the ASP.NET page?

 Thanks

"Hong-Gang Chen
NewsGroup User
Re: Return Value To Web Page2/26/2008 1:30:40 AM

0

hc1:

Hong Gang, thanks for answering.

What I am trying to do is to capture the result from a SQL query statement.  Web Developer allows a parameter to be Input or Output.  How do I make use of the Output capability?  How do I transfer a value from the SQlDataSource object back to the ASP.NET page?

 

Hi hc1,

Base on my experience, you can refer this link,  

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/repeater.aspx

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.
4 Items, 1 Pages 1 |< << Go >> >|




   
  Privacy | Contact Us
All Times Are GMT