troubleshooting Question

send logged in user's username to stored procedure

Avatar of deloused
deloused asked on
Microsoft SQL ServerC#ASP.NET
45 Comments1 Solution687 ViewsLast Modified:
I would like to pass the logged in User's username value to a Sql Server 2005 stored procedure.  This is what I have right now but it's not working.  How do I send the username value to the stored procedure?

        string strGary = System.Configuration.ConfigurationManager.ConnectionStrings["CEPDBConnectionString"].ConnectionString;
        SqlConnection conn = new SqlConnection(strGary);
        SqlCommand cmd = new SqlCommand("aspnet_GetMemberEvents");
        cmd.Connection = conn;
        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.AddWithValue("@UserName", UserName);

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 45 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 45 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros