passing variable to sql statement in asp.net 2.0?



Anyone have any ideas how this works? I've tried old school and a ton of
other things with no success. Any help would be greatly appreciated. Thanks.

<body>

<form id="form1" runat="server">

<%

'' get user login info and strip domain name....

Dim X As Object, strCompletePath As String, getUser As String

strCompletePath = Request.ServerVariables("LOGON_USER")

X = Split(strCompletePath, "\")

getUser = X(UBound(X))

strFileName.Text = getUser

%>

<asp:TextBox ID="strFileName" runat="server" MaxLength="1000"></asp:TextBox>

<br />

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="Alias"

DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to
display." CellPadding="4" ForeColor="#333333" GridLines="None">

<Columns>

<asp:BoundField DataField="Alias" HeaderText="Alias" ReadOnly="True"
SortExpression="Alias" />

<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />

<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />

<asp:BoundField DataField="Active" HeaderText="Active"
SortExpression="Active" />

</Columns>

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<EditRowStyle BackColor="#999999" />

<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"
/>

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"
/>

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

ConnectionString="<%$ ConnectionStrings:USTools_DevConnectionString1 %>"

ProviderName="<%$
ConnectionStrings:USTools_DevConnectionString1.ProviderName %>"

SelectCommand="SELECT * FROM [User] WHERE [Alias] LIKE '<%=getUser%>' "
OldValuesParameterFormatString="">

<%-- <InsertParameters>

<asp:ControlParameter

ControlID="strFileName"

DefaultValue="0"

Name="getUser"

PropertyName="Text"

Direction="Input"

ConvertEmptyStringToNull="true"

Size="1000"

/>

</InsertParameters>--%>

</asp:SqlDataSource>

</form>

</body>


.



Relevant Pages

  • passing variable to sql statement in asp.net 2.0?
    ... I've tried old school and a ton of ... other things with no success. ... Dim X As Object, strCompletePath As String, getUser As String ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Getting Windows user (Account) from a VBA routine
    ... Sub GetUserNameTest() ... Function fOSUserNameAs String ... Private Declare Function api_GetUserName Lib "advapi32.dll" Alias ... Public Function GetUser() ...
    (microsoft.public.excel.programming)
  • Re: LoginID
    ... Sub GetUserNameTest() ... Function fOSUserNameAs String ... Private Declare Function api_GetUserName Lib "advapi32.dll" Alias ... Public Function GetUser() ...
    (microsoft.public.excel.programming)
  • Re: name
    ... Sub GetUserNameTest() ... Function fOSUserNameAs String ... Private Declare Function api_GetUserName Lib "advapi32.dll" Alias ... Public Function GetUser() ...
    (microsoft.public.excel.programming)
  • Re: PC logon User Name from XP inside of Access 2003 ?
    ... Public Function GetUser() As String ... Dim sUserName As String ... On Error GoTo 0 ...
    (microsoft.public.access.modulesdaovba)