Still trying to get my head around the basics of ASP.NET at the moment but I have a question about querying a database for a field value and it's bugging me somewhat so hopefully someone a lot smarter than me can help.
I'm looking to obtain the First Name of a person based upon a query lookup to the database using the persons user id but can't seem to get it to work or display on my ASP.NET page.
Here is my code behind function
Public Function UserDetails(ByVal UserID As String) As String
Dim FirstName As String = ""
Dim strConnection As String = ConfigurationManager.ConnectionStrings("aspnet-WebSite1-13bb7ef4-4736-49de-9eb7-9b2d7393640dConnectionString1").ConnectionString
Dim SQL As String = "SELECT dbo.AspNetUsers.FirstName FROM dbo.AspNetUsers WHERE ([Id] = @NewUserID)"
Using conn As New SqlConnection(strConnection)
Dim cmd As New SqlCommand(SQL, conn)
FirstName = Convert.ToString(cmd.ExecuteScalar())
and I call this on my aspx page using
<%: UserDetails(User.Identity.GetUserId()) %>
but alas I don't get anything displayed on my page.
Anyone able to offer some assistance to this dullard lol