User-628505736 posted
Hello,
I have a problem when I want to use a variable in order to make an MS SQL query in order to retrieve data from a database
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString123 %>"
SelectCommand="SELECT [column1], [column2], [column3], [column4], [column5], [column6] FROM [Table1] WHERE ([column1] =<%= variable1%>)">
</asp:SqlDataSource>
The problem is that I do not want to use a parameter because I already have the variable behind in C# code. So I want to use something like "<%=variable1 %>"
to insert the variable into the query. But once I write that inside the query, the whole thing does
not work and comes with error messages.
Is there any way to add a variable into that query?
Remember I do not want to use parameters i.e.
<SelectParameters>
<asp:Parameter DefaultValue="1257" Name="column1" Type="String" />
</SelectParameters>