Hi, please see the code below. I am trying to access a c# variable in a sqldatasource definition. Could someone please tell me what I need to change to that I can use the domain variable in the WHERE? Thanks! I've been trying for hours... (I am new to asp, c# and sql server, since last 2 days).
I have the follwing code in a c# aspx file:
<%string domain = (HttpContext.Current.Request.ServerVariables["HTTP_HOST"]);%>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:testfirststring %>"
SelectCommand="SELECT testField FROM table1test WHERE testField = '<% domain %>' "></asp:SqlDataSource>
I am missing something to have the domain variable to be accessible in the where statement.
Everything else works (for now)! :)