retrieve record by domain user using querystring

T

Tony WONG

i wish to sort out the records by domain users using querystring

before i did in asp but now convert to asp.net

1. put the vb code in form2.aspx.vb to retrieve domain user
2. put querystring in Form.aspx to sort out the records

but not work?
****************************
Form2.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim LogonUser = Mid(Request.ServerVariables("LOGON_USER"), 6)
End Sub

Form2.aspx
<asp:SqlDataSource ID="List" runat="server"
ConnectionString="<%$ ConnectionStrings:SMStestConnectionString
%>"
SelectCommand="SELECT [Msg_Content], [UserCode] FROM [table1]
where [UserCode] = '" & LogonUser & "' ORDER BY [Done_Time] DESC">
</asp:SqlDataSource>
*************************

Grateful for any help. thx.
 
J

Joe Fawcett

Tony WONG said:
i wish to sort out the records by domain users using querystring

before i did in asp but now convert to asp.net

1. put the vb code in form2.aspx.vb to retrieve domain user
2. put querystring in Form.aspx to sort out the records

but not work?
****************************
Form2.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim LogonUser = Mid(Request.ServerVariables("LOGON_USER"), 6)
End Sub

Form2.aspx
<asp:SqlDataSource ID="List" runat="server"
ConnectionString="<%$ ConnectionStrings:SMStestConnectionString
%>"
SelectCommand="SELECT [Msg_Content], [UserCode] FROM [table1]
where [UserCode] = '" & LogonUser & "' ORDER BY [Done_Time] DESC">
</asp:SqlDataSource>
*************************

Grateful for any help. thx.
I think that you can either set the SelectCommand property in code after
retrieving the the LOGON_USER variable or use databinding syntax in the
SelectCommand attribute and make a property on the form for the
SelectCommandSql
SelectCommand='<%# SelectCommandSql) %>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top