469,890 Members | 2,319 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

.net/oracle multiple select parameter problem

Environment: .net2.0 over oracle

Problem? a simple select statement within a DetailsView that gets two parameter values from a GridView SelectedValue.

It might be valuable to understand that to pull a single record from this particular table requires two parameters.

What follows defies understanding.

The desired query:
<asp:SqlDataSource .....
SelectCommand="select * from tbl where col1 = :x AND col2 = :y"
....
<asp:ControlParameter ControlID="GridView1" Name="x" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="GridView1" Name="y" PropertyName="SelectedValue" Type="String" />
....
</asp:SqlDataSource>

Returns nothing, no response, nada, zero - though the values are plainly visible in GridView1.

A modification to try to see what's happening:
<asp:SqlDataSource .....
SelectCommand="select * from tbl where col1 = :x OR col2 = :y"
....
<asp:ControlParameter ControlID="GridView1" Name="x" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="GridView1" Name="y" PropertyName="SelectedValue" Type="String" />
....
</asp:SqlDataSource>

Changing the AND to OR returns just what the query asks for - way much more than the one record desired, but it works.

Another modification to try figure out what's happening:
<asp:SqlDataSource .....
SelectCommand="select * from tbl where col1 = 'x' or col2 = 'y'"
....
</asp:SqlDataSource>

Hard coding the values returns the desired record.

Why do the multilple selectparameters (AND) cause the query to get lost in .net?

Hard coding it in code-behind also works, but bypasses all the .net classes and makes for a ton of coding when updating, deleting and inserting and all their parameters need to be coded in. It would be good to just see .net to it's job.

This is just one query of hundreds in this application and all work if a single select parameter is used (can be used). The problem appears only when more than one select parameter is needed to return a record. Then you get nothing.

I am stumped.

If this is not the correct forum, please give directions.
Dec 29 '06 #1
1 4948
rengaraj
168 100+
What is the table structure?
What is the data type of the two columns in the Oracle table?
Feb 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by francis70 | last post: by
4 posts views Thread by susmita_ganguly | last post: by
2 posts views Thread by Dmitry Bond. | last post: by
2 posts views Thread by guanfenglin | last post: by
5 posts views Thread by ashley.ward | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.