passing variable to sql statement in asp.net 2.0?

B

billb

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>
 

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,733
Messages
2,569,440
Members
44,829
Latest member
PIXThurman

Latest Threads

Top