I was debugging an application using using .net framwork 4 in visual studio 2012 pro, with 'iAnywhere.Data.SQLAnywhere.v4.0' reference in the application; when I changed anything in the code in debug mode, I get:

Error 2 Assembly 'C:\myapp\IeStoredProcParmGenerator\obj\x86\Debug\IeStoredProcParmGenerator.exe' uses 'iAnywhere.Data.SQLAnywhere.v4.0, Version=16.0.0.13244, Culture=neutral, PublicKeyToken=f222fc4333e0d400' which has a higher version than referenced assembly 'iAnywhere.Data.SQLAnywhere.v4.0, Version=11.0.1.29604, Culture=neutral, PublicKeyToken=f222fc4333e0d400' ....

furthermore I used to be able to - close created connection without strange exception - use SACommandBuilder.DeriveParameters(cmd) and for each parm in cmd I can accesss parm.Precison and parm.Scale without exception not anymore since the sa 16 installation

Btw when I debug another sa 11 application solution that was setup before the sa 16 installation, I had no such driver conflict

asked 14 Jun '14, 01:31

gg99's gravatar image

gg99
193192129
accept rate: 0%

edited 16 Jun '14, 17:35


I'd start by searching your project (including subdirectories) for references to Version=11. It sounds like you are building with references to both Version=16 and Version=11.

Not sure what you are getting at in the second comment. Here's an example of DerviceParameters that works for me.

SACommand cmd2 = new SACommand("GROUPO.ShowCustomerProducts", conn);
cmd2.CommandType = System.Data.CommandType.StoredProcedure;
SACommandBuilder.DeriveParameters(cmd2);
// List the parameters and some of properties.
SAParameterCollection paramCollection = cmd2.Parameters;
string parameterList = "";
for (int i = 0; i < paramCollection.Count; i++)
{
    parameterList += String.Format("  {0}, DbType={1}, Dir={2}, Prec={3}, Scale={4}\n",
        paramCollection[i],
        paramCollection[i].DbType,
        paramCollection[i].Direction,
        paramCollection[i].Precision,
        paramCollection[i].Scale);
}
Console.WriteLine("Parameter Collection:\n" + parameterList);

cmd2.Parameters["customer_ID"].Value = 101;
SADataReader dr = cmd2.ExecuteReader();
while (dr.Read())
{
    System.Console.WriteLine(dr.GetString(0));
}
dr.Close();
permanent link

answered 16 Jun '14, 14:58

JBSchueler's gravatar image

JBSchueler
2.0k2836
accept rate: 16%

Comment Text Removed

for replying. the application is a single project solution, it only has reference to iAnywhere.Data.SQLAnywhere.v4.0 whose path is C:\Program Files\SQL Anywhere 11\Assembly\V4\iAnywhere.Data.SQLAnywhere.v4.0.dll

does not have any direct reference of V 16. works perfectly fine until any code is changed in debug mode. then edit and continue will not be able to proceed because somehow visual studio got confused and see v16 instead of v11 only all other sa 11 application created or migrated before instal of sa 16 has no problem whatsoever

however I failed to see anything unusual in the migrated .csproj, .sln nor csproj.user files

(18 Jun '14, 22:43) gg99

Visual Studio integration settings are managed by SetupVSPackage. Support for VS 2012 was added to 11.0.1.2777. So make sure that you run a version of SetupVSPackage from an 11.0.1 EBF that is newer than (or at) this build.

Version=11.0.1.29604 indicates a 4.0 provider from build 2960.

Version=16.0.0.13244 indicates a 4.0 provider from build 1324 (this is the GA release).

Have you tried searching all your project files ("grep") for "Version=16.0.0" to see where the reference is added.

This is a guess but I think that your problem might be related to settings in your machine.config files (there are 4 of these files on 64-bit Windows). For example, one them is here:

%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config

Look at the <dbproviderfactories> section to see which provider is referenced.

When SetupVSPackage /i is run, then the GAC is updated and the machine.config files are modified to the assemblies corresponding to the version of SetupVSPackage that you run (16.0, 12.0.1, 11.0.1, etc).

So, to work on a VS project that uses the 11.0 provider, you would have to run the 11.0 SetupVSPackage. Then, when you want to switch to a VS project that uses the 16.0 provider, you would have to rerun the 16.0 version of SetupVSPackage to re-update the machine.config files.

Try this and see if your problem goes away.

Note, there are two flavors of SetupVSPackage (one for .NET 3.5 or earlier and one for .NET 4.0 or later).

Since this is somewhat tedious, the simplest thing to do would be to migrate your 11.0 project to the 16.0 provider. The provider is backwards compatible (i.e., you can use a 16.0 provider with an 11.0 server). Switching to a new provider should be as simple as dropping the current Reference and adding a new Reference.

Let us know if this helps.

(20 Aug '14, 15:25) JBSchueler
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×194
×137
×101
×9
×3

question asked: 14 Jun '14, 01:31

question was seen: 5,411 times

last updated: 20 Aug '14, 16:03