Declarative SQL Problem

Dec 19, 2006

I can't figure out what is wrong with the code below. 

 The first line prints out correctly when I am logged in

If I substitute the actual username in the SQL, the Repeater works fine, printing out the item from the db.
But using
WHERE USERNAME='<%= User.Identity.Name%>'
in the SelectCommand returns no rows.

Can anyone help?

Thanks,

Michael

<h3>News  for <%=User.Identity.Name%></h3>

<asp:SqlDataSource ID="SqlDataSource2" runat="server"

ConnectionString="<%$ ConnectionStrings:NEWWEB %>"

ProviderName="<%$ ConnectionStrings:NEWWEB.ProviderName %>"

SelectCommand="SELECT USERNAME FROM ASPNET_MEMBERSHIP WHERE USERNAME='<%= User.Identity.Name%>' ">

</asp:SqlDataSource>

<asp:Repeater ID="FirmAlertsRepeater" runat="server" DataSourceID="SqlDataSource2">

<ItemTemplate>

<b><%# DataBinder.Eval(Container.DataItem, "USERNAME")%></b> &mdash; <br />

 

</ItemTemplate>

</asp:Repeater>

View 7 Replies


ADVERTISEMENT

Simulataneous Programmatic And Declarative Access To SQLDataSource Data

Apr 22, 2006

Hi,
Is there a way to programmatically access the results of an SQLDataSource control select at the time it is binding to a DetailView? There are some fields in the data results I do not want to render to the page, but I still need for other stuff.
I know I can programmatically invoke a select method, but since it is selecting anyway for binding to the DetailView it would be better to get all the data in one swoop.
Thanks in advance for any assistance you could provide.
Best Regards,
Brett 

View 4 Replies View Related

How Do I Declarative Bind To A Data Member Of A Custom Class Object Stored In The Session

Dec 1, 2006

I have a SqlDataSource that has a parameter that I am trying
to set.

 

 

The item is stored in a session field called “GameObject�

Game Object is a simple class that has a several variables.

I am trying to access the .name data member of the class.

 <asp:SessionParameter Name="GameCode" SessionField="((GamingSystem)Session[‘GameObject’]).Name" />  

This does not work. Is there a way to declarative bind to
the item that I am for.

 

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved