Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | zurbumYak Posting Veteran
 
 
                                        55 Posts | 
                                            
                                            |  Posted - 2004-03-27 : 12:00:33 
 |  
                                            | I have a SELECT with some JOINs and subSELECTS. In SQL Query analyzer the query returns results very fast, less than 0.1 sec. This same query from my application using ADO and SQLOLEDB provider needs more than 5 seconds. Can anyone explain me why? |  |  
                                    | jhermiz
 
 
                                    3564 Posts | 
                                        
                                          |  Posted - 2004-03-27 : 14:23:13 
 |  
                                          | Can you post your ado code, could be you arent using the correct cursors, or an effective way to make a connection to your backend database.Might want to post the query as well...Have you tried a sproc...Jon |  
                                          |  |  |  
                                    | zurbumYak Posting Veteran
 
 
                                    55 Posts | 
                                        
                                          |  Posted - 2004-03-28 : 04:44:28 
 |  
                                          | I don't have the source right here, but I've tried changing cursors, usually I use dynamic cursor. Other queries work just fine and fast too.What do you mean with sproc? |  
                                          |  |  |  
                                    | mohdowaisSheikh of Yak Knowledge
 
 
                                    1456 Posts | 
                                        
                                          |  Posted - 2004-03-28 : 07:25:20 
 |  
                                          | Try using a forward-only (adOpenForwardOnly) cursor with a read-only lock (adLockReadOnly). You shouldn't really ever have a reason to use a dynamic cursor for a production application.OS |  
                                          |  |  |  
                                    | jsmith8858Dr. Cross Join
 
 
                                    7423 Posts | 
                                        
                                          |  Posted - 2004-03-28 : 10:16:13 
 |  
                                          | Also -- what are you doing while this recordset is being returned?  Don't forget to factor that into your 5 seconds.  if for each row of data you are formatting something and doing math and adding stuff into listboxes or writing to disk, then of course it will take longer than in QA.Look into the GetRows() method of an ADO command, also, which returns all of the data in the command into an array almost instantly -- the time it takes to do THAT should be the equivalent of how long it takes to return the results in QA.- Jeff |  
                                          |  |  |  
                                |  |  |  |