davecove
asked on
Howto use multiple QueryStringParameters in a SelectCommand for a MySQL SqlDataSource
I am trying to use multiple QueryStringParameters in a SelectCommand for a MySQL SqlDataSource. I can use 1 just fine like this:
[CODE]
<asp:SqlDataSource ID="db_faa" runat="server"
ConnectionString="Dsn=my_f aa;uid=roo t;pwd=root "
ProviderName="System.Data. Odbc"
SelectCommand="SELECT faa_part, faa_part_desc, faa_status FROM tbl_faa_tracking WHERE faa_pl_desc = ?">
<SelectParameters>
<asp:QueryStringParameter Name="value" QueryStringField="value" />
</SelectParameters>
</asp:SqlDataSource>
[/CODE]
and a query string like this: ?value=TE456
But I actually need to pass in the field name as well like this: ?field=faa_pl_desc&value=T E456
so I tried changing the code to this:
[CODE]
<asp:SqlDataSource ID="db_faa" runat="server"
ConnectionString="Dsn=my_f aa;uid=roo t;pwd=root "
ProviderName="System.Data. Odbc"
SelectCommand="SELECT faa_part, faa_part_desc, faa_status FROM tbl_faa_tracking WHERE ? = ?">
<SelectParameters>
<asp:QueryStringParameter Name="field" QueryStringField="field" />
<asp:QueryStringParameter Name="value" QueryStringField="value" />
</SelectParameters>
</asp:SqlDataSource>
[/CODE]
I get no error, I just get a blank data set. It is as if the Select is returning no data even tho it has the same field name and search value in both instances. I have tired reversing the order of the 2 QueryStringParameters just in case the parameters are in a stack instead of a FIFO. No joy...
I think I just must be passing the 2 Query strings with some syntax missing?
Dave
[CODE]
<asp:SqlDataSource ID="db_faa" runat="server"
ConnectionString="Dsn=my_f
ProviderName="System.Data.
SelectCommand="SELECT faa_part, faa_part_desc, faa_status FROM tbl_faa_tracking WHERE faa_pl_desc = ?">
<SelectParameters>
<asp:QueryStringParameter Name="value" QueryStringField="value" />
</SelectParameters>
</asp:SqlDataSource>
[/CODE]
and a query string like this: ?value=TE456
But I actually need to pass in the field name as well like this: ?field=faa_pl_desc&value=T
so I tried changing the code to this:
[CODE]
<asp:SqlDataSource ID="db_faa" runat="server"
ConnectionString="Dsn=my_f
ProviderName="System.Data.
SelectCommand="SELECT faa_part, faa_part_desc, faa_status FROM tbl_faa_tracking WHERE ? = ?">
<SelectParameters>
<asp:QueryStringParameter Name="field" QueryStringField="field" />
<asp:QueryStringParameter Name="value" QueryStringField="value" />
</SelectParameters>
</asp:SqlDataSource>
[/CODE]
I get no error, I just get a blank data set. It is as if the Select is returning no data even tho it has the same field name and search value in both instances. I have tired reversing the order of the 2 QueryStringParameters just in case the parameters are in a stack instead of a FIFO. No joy...
I think I just must be passing the 2 Query strings with some syntax missing?
Dave
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.