
August 15th, 2002, 10:30 AM
|
|
Junior Member
|
|
Join Date: Jun 2002
Posts: 8
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Using stored uid for query
I have a login page from which I pass the UID value to any subsequent page requested. The reason I do this is becuase I want to be able to query against the uid to retieve additionial information about the user.
The problem is that I can only seem to retrieve the uid value through a label control. Does anyone know of a way that I can retrieve this value inside of a query statement?
Here is my code to this point:
Code:
<script language="VB" runat="server">
Sub Page_Load
lblUID.Text = User.Identity.Name
Dim strConn as string ="server=ntphoenix;database=plan;uid=sa;pwd="
Dim Conn as new SQLconnection(strConn)
Dim strSQL as string ="select id, dt from Week_Ending_Date"
Dim Cmd as New SQLCommand(strSQL,Conn)
Conn.Open()
wed.DataSource = Cmd.ExecuteReader()
wed.DataBind()
Conn.close()
strSQL = "Select * FROM Employee where UID = 'lblUID'"
Dim Cmd5 as New SQLCommand(strSQL,Conn)
Conn.Open()
fullnm.DataSource = Cmd5.ExecuteReader()
fullnm.DataBind()
Conn.Close()
<asp:dropdownlist ID="fullnm" DataValueField="id" DataTextField="LastName" Runat="server" />
Which brings up another point. As you can see I am binding the result of the query to a dropdownlist box. Since the result will return only one name, it seems kind of much to use a dropdownlist box however, I could find a way to populate a textbox.
Anyone have any thoughts on that as well?
Thanks for your time and comments.
Regards,
Tim
|