views:

225

answers:

2
A: 

Because you are assigning the value to an attribute of an element in markup. You can certainly do this in the code behind by setting the property, but without spacing instead of code-like concatenation this can't work.

Have you tried:

<asp:SqlDataSource ID="SqlDataSource2" runat="server"
    ConnectionString="<%$ ConnectionStrings:conStr %>"
    SelectCommand=
      "SELECT * 
       FROM myTable
       ...Where...">
</asp:SqlDataSource>

?

Quintin Robinson
You were correct, the concatenation '+' wasn't needed.
flavour404
+2  A: 

If you want to write your query in multiple lines write it without the concatenation like that :

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
     ConnectionString="<%$ ConnectionStrings:conStr %>" 
     SelectCommand="SELECT * 
                   FROM myTable">
</asp:SqlDataSource>
Canavar
Thanks, you were right, it worked great.
flavour404