Solved

Select Command "Where Clause"

Posted on 2014-02-22
2
289 Views
Last Modified: 2014-02-23
I have the following select command that has numerous conditions set in my Where Clause or select statement.   I have a dropdownlist named "Sta" where an individual station can be selected to display in the gridview.   There are other conditions that are identified under "Status" that are also displayed for the specific station that determine what data is to be displayed.

In it's current format it is not filtering specifically to the station and displaying only that station information.   I need assistance with the Select Statement Code.


 SelectCommand="SELECT ID, AOSdate, Ship, ArrTime, InFlt, History, ETRDate, ETRTime, Sta, Reason1, Updated, Status, ETR FROM AOS WHERE ((((((((((((((((((((((((((((([Sta] = @Sta) AND (Status = @Status) OR (Status = @Status2) OR (Status = @Status3) OR (Status = @Status4) OR (Status = @Status5) OR (Status = @Status6) OR (Status = @Status7) OR (Status = @Status8) OR (Status = @Status9) OR (Status = @Status10) OR (Status = @Status11) OR (Status = @Status12) OR (Status = @Status13) OR (Status = @Status14) OR (Status = @Status15) OR (Status = @Status16) OR (Status = @Status17) OR (Status = @Status18) OR (Status = @Status19) OR (Status = @Status20) OR (Status = @Status21) OR (Status = @Status22) OR (Status = @Status23) OR (Status = @Status24) OR (Status = @Status25) OR (Status = @Status26) OR (Status = @Status27) OR (Status = @Status28))))))))))))))))))))))))))))) ORDER BY Status" 

Open in new window


 <SelectParameters>

                        <asp:ControlParameter ControlID="Sta" Name="Sta" PropertyName="SelectedValue" 
                            Type="String" />


                        <asp:QueryStringParameter DefaultValue="AOG" Name="Status" 
                           QueryStringField="Status" Type="String" />
			         
		               <asp:QueryStringParameter DefaultValue="AOG - R/T" Name="Status2" 
                           QueryStringField="Status" Type="String" />
			         
                       <asp:QueryStringParameter DefaultValue="Working Spare" Name="Status3" 
                           QueryStringField="Status" Type="String" />		          
                  
                       <asp:QueryStringParameter DefaultValue="Ready Spare" Name="Status4" 
                           QueryStringField="Status" Type="String" />                  
                  
                       <asp:QueryStringParameter DefaultValue="Ready Spare - A/C Hooked - WU-cw" Name="Status5" 
                           QueryStringField="Status" Type="String" />                  
                  
                       <asp:QueryStringParameter DefaultValue="Status Ready Spare - Needs WU-ck" Name="Status6" 
                           QueryStringField="Status" Type="String" />                    
                  
                       <asp:QueryStringParameter DefaultValue="ETOPS - Working" Name="Status7" 
                           QueryStringField="Status" Type="String" />   
                           
                       <asp:QueryStringParameter DefaultValue="High Priority" Name="Status8" 
                           QueryStringField="Status" Type="String" />   
                           
                       <asp:QueryStringParameter DefaultValue="Ready Spare - Needs WU ck" Name="Status9" 
                           QueryStringField="Status" Type="String" /> 
                           
                       <asp:QueryStringParameter DefaultValue="Ready Spare - A/C Hooked - Needs WU" Name="Status10" 
                           QueryStringField="Status" Type="String" />
                           
                       <asp:QueryStringParameter DefaultValue="SOS - Working" Name="Status11" 
                           QueryStringField="Status" Type="String" /> 
                           
                       <asp:QueryStringParameter DefaultValue="AOG - Vendor" Name="Status12" 
                           QueryStringField="Status" Type="String" />                                                                                                                                    
                                
                       <asp:QueryStringParameter DefaultValue="AOG-Sched/Work Elective" Name="Status13" 
                           QueryStringField="Status" Type="String" />			
			
                       <asp:QueryStringParameter DefaultValue="AOG-Sched/Work Required" Name="Status14" 
                           QueryStringField="Status" Type="String" />

                       <asp:QueryStringParameter DefaultValue="Alert ETOPS Fly Day" Name="Status15" 
                           QueryStringField="Status" Type="String" />

                       <asp:QueryStringParameter DefaultValue="Alert Requires Verification Flight" Name="Status16" 
                           QueryStringField="Status" Type="String" />

                       <asp:QueryStringParameter DefaultValue="Alert Domestic Ops Only - Non Etops" Name="Status17" 
                           QueryStringField="Status" Type="String" />           
            
                       <asp:QueryStringParameter DefaultValue="AOG Off Station Repairs" Name="Status18" 
                           QueryStringField="Status" Type="String" />             
			
                       <asp:QueryStringParameter DefaultValue="AOG - SSE ATA Category Item" Name="Status19" 
                           QueryStringField="Status" Type="String" />
                           
                       <asp:QueryStringParameter DefaultValue="MMCO-Open" Name="Status20" 
                           QueryStringField="Status" Type="String" />                           
                                      
                       <asp:QueryStringParameter DefaultValue="Alert ETOPS Qualified" Name="Status21" 
                           QueryStringField="Status" Type="String" />              
            
                       <asp:QueryStringParameter DefaultValue="ETOPS Fly Day" Name="Status22" 
                           QueryStringField="Status" Type="String" />
                           
                       <asp:QueryStringParameter DefaultValue="AOG Off Station MX Ferry To (LAS)" Name="Status23" 
                           QueryStringField="Status" Type="String" />

                    <asp:QueryStringParameter DefaultValue="MCO-Open" Name="Status24" 
                           QueryStringField="Status" Type="String" />
                            
                    <asp:QueryStringParameter DefaultValue="Charter" Name="Status25" 
                           QueryStringField="Status" Type="String" />       
                                
                    <asp:QueryStringParameter DefaultValue="High Priority-Interior" Name="Status26" 
                            QueryStringField="Status" Type="String" />

                    <asp:QueryStringParameter DefaultValue="High Priority-Exterior" Name="Status27" 
                            QueryStringField="Status" Type="String" />
                           
                    <asp:QueryStringParameter DefaultValue="Charter Tech Req" Name="Status28" 
                            QueryStringField="Status" Type="String" />     
                                                                               
                    </SelectParameters>

Open in new window

0
Comment
Question by:BOEING39
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39879625
That's a lotta brackets

 SelectCommand="SELECT ID, AOSdate, Ship, ArrTime, InFlt, History, ETRDate, ETRTime, Sta, Reason1, Updated, Status, ETR FROM AOS WHERE [Sta] = @Sta AND (Status = @Status OR Status = @Status2 OR Status = @Status3 OR Status = @Status4 OR Status = @Status5 OR Status = @Status6 OR Status = @Status7 OR Status = @Status8 OR Status = @Status9 OR Status = @Status10 OR Status = @Status11 OR Status = @Status12 OR Status = @Status13 OR Status = @Status14 OR Status = @Status15 OR Status = @Status16 OR Status = @Status17 OR Status = @Status18 OR Status = @Status19 OR Status = @Status20 OR Status = @Status21 OR Status = @Status22 OR Status = @Status23 OR Status = @Status24 OR Status = @Status25 OR Status = @Status26 OR Status = @Status27 OR Status = @Status28) ORDER BY Status" 

Open in new window

0
 

Author Closing Comment

by:BOEING39
ID: 39881525
Thx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now