Installing VS2012 w/ 2010 affects C# DB factory calls?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hey everyone:
I have a project developed under VS 2010 with .Net framework 4.0.
Before installing VS 2012, the following code ran perfectly (never any issue) for ODBC connections:
<pre class="prettyprint public void OpenDBConnectionToSource(TaskClass.SourceObject so)
{
try
{
connectionSource = factory.CreateConnection();
connectionSource.ConnectionString = so.ConnectionString;
connectionSource.Open();
}
catch (OdbcException ex)
{
throw;
}
catch (SqlException ex)
{
throw;
}
catch (Exception ex)
{
throw;
}
}[/code]
<br/>
Now, after installing VS 2012:
1) I can no longer run in "debug mode" with "any cpu". It returns an architecture related error (guessing the 32 vs 64 bit ODBC driver issue)
2) I change to debug in "x86" and the code only runs half the time now. The other half the Open() method throws the following exception:
<span style="font-family:Calibri,sans-serif; font-size:11pt {"ERROR [IM004] [Microsoft][ODBC Driver Manager] Drivers SQLAllocHandle on SQL_HANDLE_ENV failed"}
<span style="font-family:Calibri,sans-serif; font-size:11pt 3) If I uninstall VS2012, everything works perfectly.
<span style="font-family:Calibri,sans-serif; font-size:11pt 4) If I change the above source code to be ODBC specific (eg, using calls like

<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small
OdbcConnection connectionSource = new OdbcConnection(SettingsManager.SourceConnection)

<span style="font-family:Calibri,sans-serif; font-size:11pt ) instead of the more generic factory call, it works fine. Unfortunately I cant change it to permanently be ODBC specific because SQLServer related methods might be using it as well.
<span style="font-family:Calibri,sans-serif; font-size:11pt
<span style="font-family:Calibri,sans-serif; font-size:11pt The current project cant be ported to VS 2012 yet, but we have to develop some new stuff with the VS 2012, so I cant quite uninstall that either.
<span style="font-family:Calibri,sans-serif; font-size:11pt Has anyone else experienced anything like this? Or would have any possible suggestions to try?

<span style="font-family:Calibri,sans-serif; font-size:11pt Thanks!

View the full article
 
Back
Top