Dynamically alter SQL Statement Help Please!!

Oct 26 2006 6:14 PM
I'm trying to dynamically alter an SQL statement by using a variable(u_name), but cannot get it to work. It seems that setting the value in the script does does carry outside the script?? Any help would be appreciated.

<Script runat="server">

Dim u_name As String = Me.User.Identity.Name

</Script>
<asp:AccessDataSource ID = "AccessDataSource1" runat="server" DataFile="C:\Documents and Settings\Charlie\My Documents\Visual Studio 2005\Projects\Student_Database\Enrollment_DB.mdb"

SelectCommand="SELECT [StudentID], [SSN], [FirstName], [LastName], [Address], [Major], [Student Type] AS Student_Type, [Student Status] AS Student_Status, [Date of Birth] AS Date_of_Birth, [GPA] FROM [Students] WHERE ([xUserName] = @u_name)">

<SelectParameters>
<asp:Parameter Name="u_name" Type="String" />
</SelectParameters>

</asp:AccessDataSource>


Answers (1)