Sorting by userID

    Date: 05/25/06 (Asp Dot Net)    Keywords: sql, security

    I'm trying to sort by domain user id, I can pull the user id fine but now I want to sort my SELECT by that name. How do I put the value of getUserIdentity into my SELECT statment.

    Thanks

    protected string getUserIdentity()
    {
    return HttpContext.Current.User.Identity.Name.ToString().Replace("DOMAIN\\", "");
    }

    protected void Page_Load(Object sender, EventArgs e)
    {
    username = getUserIdentity();

    SqlConnection myConnection = new SqlConnection("Data Source=CLIENTELE;Initial Catalog=forms;Integrated Security=True");
    SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * FROM formTable WHERE userID = @username ORDER BY status DESC", myConnection);

    DataSet ds = new DataSet();
    myCommand.Fill(ds, "names");

    MyDataGrid.DataSource=ds.Tables["names"].DefaultView;
    MyDataGrid.DataBind();
    }

    Source: http://community.livejournal.com/aspdotnet/68149.html

« 2.0 postbacks || Grid Views are ugly. »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home