views:

46

answers:

1

I'm selecting table data of the current user:

SELECT [ConfidenceLevel], [LoveLevel], [HappinessLevel] FROM [UserData] WHERE ([UserProfileID] = @UserProfileID)

I have set a control to the unique user ID and it is getting the correct value:

HTML: <asp:Label ID="userID" runat="server" Text="Labeluser"></asp:Label>

C#: userID.Text = Membership.GetUser().ProviderUserKey.ToString();  

I then use it in the where clause using the Configure Data Source window
unique ID = control then controlID userID (fills in .text for me)

I compile and run but nothing shows up where the table should be. Any suggestions?

Here is the code it has created:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataSourceID="SqlDataSource1">
    <Columns>
        <asp:BoundField DataField="ConfidenceLevel" HeaderText="ConfidenceLevel" 
            SortExpression="ConfidenceLevel" />
        <asp:BoundField DataField="LoveLevel" HeaderText="LoveLevel" 
            SortExpression="LoveLevel" />
        <asp:BoundField DataField="HappinessLevel" HeaderText="HappinessLevel" 
            SortExpression="HappinessLevel" />
    </Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ConnectionStringToDB %>" 
    SelectCommand="SELECT [ConfidenceLevel], [LoveLevel], [HappinessLevel] FROM [UserData] WHERE ([UserProfileID] = @UserProfileID)">
    <SelectParameters>
        <asp:ControlParameter ControlID="userID" Name="UserProfileID" 
            PropertyName="Text" Type="Object" />
    </SelectParameters>
</asp:SqlDataSource>
+2  A: 

i have answered on the asp.net page as well but in case you dont see that one i'll do it here as well...

take out any reference to "object" the sqldatasource code generates...

it should read:

PropertyName="Text" />

if you have update and insert and delete you'll have to remove it from there as well...

andrew
Awesome thank you.
Greg McNulty