Help with SelectCommand

M@rtin

New member
Joined
Apr 14, 2010
Messages
1
Programming Experience
Beginner
Hi. This is my first post and I am a .net beginner.

I need help with the following datasource/selectcommand:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TidsReg %>"
SelectCommand="SELECT * FROM Data WHERE @P_Header = @P_Select " >
<selectParameters>
<asp:ControlParameter ControlID="P_Header" Name="P_Header" PropertyName="Value" Type="String" />
<asp:ControlParameter ControlID="P_Select" Name="P_Select" PropertyName="Value" Type="String" />
</selectParameters>
</asp:SqlDataSource>


@P_Header is a Column and @P_Select is a value (Chosen by the user)

The select command doesnt seem to use/get the @P_Select value into the SeletCommand - it seem to show 'NULL'.

I have doublechecked that both @P_Select and @P_Header contain a value by binding them to a textbox.

So there must be something with the SelectCommand itself which needs to be done different in order to use both variables.

Please help.

Best regards
M@rtin
 
Back
Top