Results 1 to 12 of 12
  1. #1
    Join Date
    Nov 2003
    Posts
    19

    Unanswered: SQL DMO Backup Question

    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())
    SqlBackup.SQLBackup(SQLServers)
    SQLServers.DisConnect()

  2. #2
    Join Date
    Oct 2003
    Location
    Ireland
    Posts
    54
    What version of VB as you using + SQL ?

    Let me know and I'll take a look for you

  3. #3
    Join Date
    Oct 2003
    Location
    Ireland
    Posts
    54
    I've tried this on VB6 against SQL 2000. I questioned which VB because you're syntax was strange.

    I only found locking/processes etc, during the backup until the
    SQLServers.DisConnect was performed.

    Have you tried to set the dmo objects to nothing ?

    Set SqlBackup = Nothing
    Set SQLServers = Nothing

    Mark

  4. #4
    Join Date
    Nov 2003
    Posts
    19
    Hi Mark,

    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?

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    What happens with that 1 table - an error, nothing returned ???

  6. #6
    Join Date
    Nov 2003
    Posts
    19
    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.

  7. #7
    Join Date
    Feb 2002
    Posts
    2,232
    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 ?

  8. #8
    Join Date
    Nov 2003
    Posts
    19
    I'm sorry if I did not mention this. Its a Windows Application written in VB.NET.

    I will be able to retrieve data only if I exit my application and open it again.

    >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 ?

    I'm trying that now.

  9. #9
    Join Date
    Feb 2002
    Posts
    2,232
    Are you destroying the connection and recreating the connection when you open the form ?

  10. #10
    Join Date
    Nov 2003
    Posts
    19
    Hi,

    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.

    Btw, I like this forum.

  11. #11
    Join Date
    Feb 2002
    Posts
    2,232
    Yeah - the only thing that made sense was that something changed with the connection.

  12. #12
    Join Date
    Nov 2003
    Posts
    19
    hehe.. yeah man. this was driving me crazy coupled with the fact that ComponentOne's components can be buggy sometimes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •