Attaching db using SMO fails on production server

  • My application needs to attach a new database to the SQL Server 2005 instance, & needs the facility to specify the dbo identity for the attached db.

    I have used some C# smo code like:

    string[] _files = new string[] {"myMdfFilePath"};

    new Server("myServerName").AttachDatabase("myDBName", _files, "myDboName");

    This works fine in the development environment (WinXP) but when deployed on a Windows Server 2003 machine it fails with an error message like:

    Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    Is this a problem with the production sql server installation? Could I pehaps work around it by including the .dll in my application bin?

    Any clues gratefully received.

    Cheers,

    Ian

  • http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=1786146&SiteID=17

    Tharindu Dhaneenja
    http://spaces.msn.com/dhaneenja

  • Thanks, Dhaneenja

    Unfortunately it's not relevant to my problem.

    regards,

    Ian

  • Typically the error shown is when the pathing is wrong. Perhaps the production system has different drive paths or you don't have rights to open the file.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply