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 |  
                                    | martij2Starting Member
 
 
                                        4 Posts | 
                                            
                                            |  Posted - 2009-05-01 : 08:07:03 
 |  
                                            | Hi i am developing an application that restores a sql2005 database, runs some select statements over the database to collect some data.The app is in VB.net 2005.This is repeated for the number of sql backups found in a folder. This works fine first time through, the database is restored, the data is collected etc. When the code attempts to restore the next backup i get an error saying the database cannot be opened exclusively. I am closing and disposing of the connection before opening again to repeat the process but still no joy. I am wondering do i need to send another statement at the end of the restore to release any connections or something like that? |  |  
                                    | sodeepMaster Smack Fu Yak Hacker
 
 
                                    7174 Posts | 
                                        
                                          |  Posted - 2009-05-09 : 23:28:14 
 |  
                                          | You can set it to Single-User and restore/Overwrite Databases and Set it to Multi-User when done. |  
                                          |  |  |  
                                |  |  |  |