What is the proper syntax for retrieving querystring in db query, if the querystring is in code behind?
Code that compiles but does not retrieve
<script runat = "server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myvalue as String = Request.QueryString("value")
End Sub
</script>
<asp:SqlDataSource ID="SqlDataSource1 runat="server" ConnectionString="<%$ ConnectionStrings:testConnectionString1 %>" ProviderName="<%$ ConnectionStrings:testConnectionString1.ProviderName %>"
SelectCommand="SELECT table1.column1 FROM table1 WHERE table1.column1 = N'@myvalue')">
<SelectParameters>
<asp:QueryStringParameter Name="myvalue" QueryStringField="value" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:FormView ID="FormView" runat="server" DataSourceID="SqlDataSource">
<ItemTemplate>
<asp:Label ID="labell" runat="server" Text='<%# Bind("column2") %>'>
</asp:Label>
</ItemTemplate>
</asp:FormView>
Code that compiles but does not retrieve
<script runat = "server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myvalue as String = Request.QueryString("value")
End Sub
</script>
<asp:SqlDataSource ID="SqlDataSource1 runat="server" ConnectionString="<%$ ConnectionStrings:testConnectionString1 %>" ProviderName="<%$ ConnectionStrings:testConnectionString1.ProviderName %>"
SelectCommand="SELECT table1.column1 FROM table1 WHERE table1.column1 = N'@myvalue')">
<SelectParameters>
<asp:QueryStringParameter Name="myvalue" QueryStringField="value" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:FormView ID="FormView" runat="server" DataSourceID="SqlDataSource">
<ItemTemplate>
<asp:Label ID="labell" runat="server" Text='<%# Bind("column2") %>'>
</asp:Label>
</ItemTemplate>
</asp:FormView>