Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,

I have the same probleme since monday...
I'm looking for filtering my SQL's columns user field from the current windows's userid .

I followed some explaination but nothing works i let you see my code:

in my ASP page I would test with a short query:

XML
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:LabAccManConnectionString %>"
    selectcommand="SELECT * FROM [account_user] WHERE [genacc_user_adacc] = @genacc_user_adacc">
    <selectparameters>
        <asp:parameter name="genacc_user_adacc" type="String" />
    </selectparameters>
</asp:sqldatasource>



when i put 'hermans5' instead of @genacc_user_adacc it works it displays one line properly into my grid view

may be it come from the "code behind":

MSIL
Imports System.Text.RegularExpressions
Imports System


Partial Class userpage
    Inherits System.Web.UI.Page
    Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting
        e.Command.Parameters("@genacc_user_adacc").Value = Me.User.Identity.Name
    End Sub
End Class




Thanks you in advance, this problem makes me crazy it don't understand at all :(

Thanks

Best Regards


Samuel
Posted

1 solution

VB
Dim name As String = User.Identity.Name.Split("\"c)(1) before e.Command.Parameters("@genacc_user_adacc").Value = name
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900