I am trying to select from sql database on page load, and i want to write out that selection to a label.
here is what i have so far, but it seems to not be working.
Session("UserInfo") = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().Username
WelcomeLabel.Text = Session.Item("UserInfo").ToString()
Dim dt As New DataTable()
Dim connection As New SqlConnection("mystring")
connection.Open()
Dim sqlCmd As New SqlCommand("SELECT EMPID FROM EMPEmployees WHERE EMPUserName = '" & WelcomeLabel.Text & "'", connection)
Dim sqlDa As New SqlDataAdapter(sqlCmd)
sqlDa.Fill(dt)
If dt.Rows.Count > 0 Then
EMPIDLabel.Text = dt.Rows(0)("EMPID").ToString()
End If
Can anyone fill me in on how to make this work?