Pimplebutt

Update datasources for layers in an MXD

Discussion created by Pimplebutt on Jan 24, 2011
Latest reply on Jan 25, 2011 by jeffmatson
My environment...
Windows 7 32-bit (and 64-bit as you'll see later)
Visual Studio 2008
Visual Basic.NET
ArcObjects 9.3 (and Service Pack if any)

For the quickest, easiest way to understand what I am asking, please see the attached picture and follow along as I reference the pic.

As you can see, there are 2 highlighted items. My issue comes about as a result of trying to use this MXD on a Windows 7 64-bit system. It works fine on Windows 7 32-bit because the paths are correct, however, on a Windows 7 64-bit system, Microsoft decided to completely screw up their paths causing much heartache to millions of developers migrating to Windows 7 64-bit.

On a Windows 7 32-bit system...
The parcel layer's datasource per the picture is...
C:\Program Files\Assessor\Common\GIS\weeklyparcel.gdb

Several other layer's datasources per the picture are...
C:\Program Files\Assessor\Common\GIS


However, on a Windows 7 64-bit system...
The parcel layer's datasource is actually located here...
C:\Program Files (x86)\Assessor\Common\GIS\weeklyparcel.gdb

Several other layer's datasources are actually located here...
C:\Program Files (x86)\Assessor\Common\GIS

I would like to be able to simply update these paths as needed. I have code that tells me whether I am on a 32-bit O.S. or a 64-bit O.S. but I have no idea how to update these datasources through ArcObjects .NET code

So that's my question... how do I update these paths on-the-fly using ArcObjects .NET, so that I don't have to have one MXD for 64-bit version of Windows, and another MXD for the 32-bit version of Windows.

Thanks a lot.

Attachments

Outcomes