0

I'm trying to load some specific information on a page depending on what logged in user loads the page. I did my best googling my problem but I couldn't find the solution.

   <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:werknem taken connection string %>" 
    SelectCommand="SELECT [Description], [State], [assessment] FROM [TaskInfo] WHERE ([EmployeeID] = @EmployeeID)">
    <SelectParameters>
        <asp:Parameter DefaultValue="" Name="@EmployeeID" Type="String" />
    </SelectParameters>
</asp:SqlDataSource>

And

Imports System.Data.SqlClient
Imports System.Data
Partial Class werknemer
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        SqlDataSource1.SelectParameters.Add("@EmployeeID", User.Identity.Name)
        GridView1.DataBind()
    End Sub
End Class

Some help would be greatly appreciated.

Pablo
  • 111
  • 4
  • Oh I forgot to say that EmployeeID in my table has the same name as the login accounts. For example I got an account with login "Paul" and I've got a "Paul" in my sqlTable under employeeID – Pablo May 04 '13 at 04:42
  • Try `SqlDataSource1.SelectParameters("@EmployeeID") = User.Identity.Name` – codingbiz May 04 '13 at 04:51
  • I replace This line: SqlDataSource1.SelectParameters.Add("@EmployeeID", User.Identity.Name) with your line of code but it didn't work. Am I doing something wrong? thanks for answering. – Pablo May 04 '13 at 05:02
  • Remove the `@` from your parameter name. Should be ` – codingbiz May 04 '13 at 08:05

0 Answers0