Solved

Select Command "Where Clause"

Posted on 2014-02-22
2
290 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
daypilot scheduler 3 26
Hey!! 5 33
Linq asp.net mvc 13 6
If condition on Html with Asp 11 14
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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