Running with VS 2010, Office 2010, SQL Server 2008 R2 under Windows 7 (x64) I was getting the below error. Looking into it, I found that if I made the following changes to the source based on a MSDN Support Document (
http://support.microsoft.com/kb/310083) rather than the CodePlex ones, it solved the problem.
Essentially delete the references to the adodb, msdasc, and oledb error. Add the ADODB and Microsoft ActiveX Data Objects 2.7 (I used 6.0 which is the latest) and Microsoft OLEDB Service Component 1.0 Type Library references per the document via the References->COM. Then make the following changes to the PromptForConnectionString method...
Before
MSDASC.DataLinks dataLinks = new MSDASC.DataLinksClass();
ADODB.Connection dialogConnection;
string generatedConnectionString = string.Empty;
if (currentConnectionString == String.Empty)
{
dialogConnection = (ADODB.Connection)dataLinks.PromptNew();
generatedConnectionString = dialogConnection.ConnectionString.ToString();
}
After
MSDASC.DataLinks dataLinks = new MSDASC.DataLinks();
ADODB._Connection dialogConnection;
string generatedConnectionString = string.Empty;
if (currentConnectionString == String.Empty)
{
dialogConnection = (ADODB._Connection)dataLinks.PromptNew();
generatedConnectionString = dialogConnection.ConnectionString.ToString();
}
Now it works without throwing the exception.
************** Exception Text **************
System.BadImageFormatException: Could not load file or assembly 'Interop.MSDASC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Interop.MSDASC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at DataDictionaryCreator.Main.PromptForConnectionString(String currentConnectionString)
at DataDictionaryCreator.Main.SetConnectionString()
at DataDictionaryCreator.Main.btnSetConnectionString_Click(Object sender, EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
DataDictionaryCreator
Assembly Version: 1.2.0.0
Win32 Version: 1.2.0.0
CodeBase: file:///C:/Users/schletterc.TECHNOLIGENCE/AppData/Local/Apps/2.0/WV060HEX.70K/VB51NXE9.MWK/data..tion_a163f1f54368f8dc_0001.0003_b6a32ed07225a7ff/DataDictionaryCreator.exe
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
System.Deployment
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
Microsoft.SqlServer.Smo
Assembly Version: 10.0.0.0
Win32 Version: 10.50.1600.1 ((KJ_RTM).100402-1539 )
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Smo/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.Management.Sdk.Sfc
Assembly Version: 10.0.0.0
Win32 Version: 10.50.1600.1 ((KJ_RTM).100402-1539 )
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Management.Sdk.Sfc/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Management.Sdk.Sfc.dll
Microsoft.SqlServer.ConnectionInfo
Assembly Version: 10.0.0.0
Win32 Version: 10.50.1600.1 ((KJ_RTM).100402-1539 )
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.ConnectionInfo/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Dmf
Assembly Version: 10.0.0.0
Win32 Version: 10.50.1600.1 ((KJ_RTM).100402-1539 )
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Dmf/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Dmf.dll
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
rcnyezs0
Assembly Version: 1.2.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
Microsoft.SqlServer.SqlClrProvider
Assembly Version: 10.0.0.0
Win32 Version: 10.50.1600.1 ((KJ_RTM).100402-1539 )
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.SqlClrProvider/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.SqlClrProvider.dll
System.Transactions
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
System.EnterpriseServices
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
System.Security
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.