Does backing up a database using SQLDMO create any kind of handle on the database?
I have included a backup script in my main application. After backing up the database, I can't retrieve values from a particular table. The rest of tables are accessible though. Puzzled here. Any ideas welcome.
Here is the code I am using to backup:
Dim SqlBackup As SQLDMO.Backup = New SQLDMO.BackupClass
SqlBackup.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database
SqlBackup.Database = "TAS"
SqlBackup.Files = "C:\backup.bak"
Dim SQLServers As SQLDMO._SQLServer = New SQLDMO.SQLServerClass
SQLServers.Connect(my_config.get_ServerName(), my_config.get_DBUserID(), my_config.get_Password())
Thanks for your reply. I am using VB.NET That's why you are finding the syntax weird.
I have tried your suggestions, but I am still getting the same problem. Strangely, the problem appears only where I am using a particular third party component. It might not be a backup problem after all, but I am curious to know what happens exactly during backup. Are all users kicked out of the database?
Actually one of my window forms is making use of Component One's C1DataObject, which is equivalent to the SqlDataAdapter.
After I do a backup of the database and launch the window form containing this C1DataObject, I get will an error "Login
failed for user (null). Reason: Not associated with a trusted SQL Server
connection." and my form would be unable to display any data from a table I am selecting from.
Is this an ASP.Net app or Windows app ? And will you never be able to retrieve data from that 1 table - no matter how many times you open/close the app or reboot ? Also, have you tried creating a vb.net app that connects and retrieves data from this table to see if the 3rd party component is the problem ?
Problem solved. Thanks for your help. It was something very minor actually.
My backup application has a SaveFileDialog which changes the value CurrentDirectory variable in System.Environment to the filepath I choose to do backup. I am actually using this CurrentDirectory value in one of my configuration files and in building my connection string. Hence all the weird problems.