By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,822 Members | 729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,822 IT Pros & Developers. It's quick & easy.

.net/oracle multiple select parameter problem

P: 1
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
Share this Question
Share on Google+
1 Reply


100+
P: 168
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.