CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2013
    Posts
    2

    .NET 4.0; Microsoft.SqlServer.Replication.ComErrorException; building in "x86"

    Hello,

    I have a quick question that I have really been struggling with as of late. I'm going to keep it simple. I am developing an application that uses a two databases running different types of Sql Server, one 32-bit and the other 64 bit. Basically, I need to build my application using Configuration properties of "x86" because accessing the 32-bit database has been deemed more important. The problem occurs when accessing the 64-bit database, I receive the exception Microsoft.SqlServer.Replication.ComErrorException, "class not registered". Unfortunately I can't use the most suggested solution of changing the build properties to "Any CPU" because it breaks access to the 32-bit database. Does anyone have an idea about how I would fix this in another manner? I've tried adding references to Microsoft.SqlServer.Replication.dll, Microsoft.SqlServer.Rmo.dll among others and still no luck. Any advice is appreciated and I thank you in advance.

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: .NET 4.0; Microsoft.SqlServer.Replication.ComErrorException; building in "x86"

    My Personal Solution idea..

    Split the Two different SQL Database Access modules into separate Class Projects (DDL's), and a Main app to move data between the two, All three under a single solution... This way you can optomise each class project to work correctly with the relevant SQL Database's...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    May 2013
    Posts
    2

    Re: .NET 4.0; Microsoft.SqlServer.Replication.ComErrorException; building in "x86"

    Hello GremlinSA,

    Thanks for the reply. I don't think I really have the authorization to completely refactor the code for the tool that we are developing. Do you think there are any quick fixes to this issue, possibly something that I could add to the project that allows for 32-bit and 64-bit SQL Server access?

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: .NET 4.0; Microsoft.SqlServer.Replication.ComErrorException; building in "x86"

    Quick fix's are exactly that... A Quick Fix, that turns around and Bites you in the ***, when you not looking...

    Fix it properly, Get the Authorization to Split the code, and do it right... If not.. you'll be chasing problems for a long time...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: .NET 4.0; Microsoft.SqlServer.Replication.ComErrorException; building in "x86"

    Quote Originally Posted by JSHEE View Post
    Do you think there are any quick fixes to this issue, possibly something that I could add to the project that allows for 32-bit and 64-bit SQL Server access?
    Agree with Gremlin. You are kind of stuck here, because you have to target building for 32-bit and 64-bit and you can't target both at once. So one solution (as Gremlin suggested) is to pull out the parts that are compiler specific into two separate assemblies. Maybe label one MyAssembly.Sql.Replication.32.dll and the other MyAssembly.Sql.Replication.64.dll and build each with the appropriate 32 or 64 bit build setting. When you install your app, detect which OS you are running under and install the appropriate dll.

    Sometimes refactoring just a little bit will end up saving a bunch of time and refactoring the replication specific code into separate assemblies shouldn't really take too much time.

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured