retrieve record by domain user using querystring

  • Thread starter Thread starter Tony WONG
  • Start date Start date
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.
 
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) %>
 
Back
Top