cancel
Showing results for 
Search instead for 
Did you mean: 

SA 11.0.1.2467 BUG

Former Member
2,632

Version 11.0.1.2467 have a new BUG in .NET driver.

If you try to execute a sql with string parameter it's throws an exception Not enough values for host variables.

It works fine using int parameters. Didn't try with another types.

Here is a sample application.

class Program
{
    static void Main(string[] args)
    {
        var factory = DbProviderFactories.GetFactory("iAnywhere.Data.SQLAnywhere");

using (var connection = factory.CreateConnection())
        {
            connection.ConnectionString = "my connection string";
            connection.Open();

try
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "select count(*) from DUMMY where (dummy_col = ?)";
                    command.Parameters.Add(factory.CreateParameter());
                    command.Parameters[0].Value = 1;

Console.WriteLine("[Int] {0} records found.", command.ExecuteScalar());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Int Exception: {0}", ex.Message);
            }

try
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "select count(*) from DUMMY where (cast(dummy_col as varchar(10)) = ?)";
                    command.Parameters.Add(factory.CreateParameter());
                    command.Parameters[0].Value = "1";

Console.WriteLine("[String] {0} records found.", command.ExecuteScalar());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("String Exception: {0}", ex.Message);
            }
        }

Console.ReadLine();
    }
}

WORKAROUND use build 2427

Accepted Solutions (1)

Accepted Solutions (1)

MCMartin
Participant

You should post this to the official newsgroup or use the following way:

How do I report a bug?

Log in to http://case-express.sybase.com.

Bugs reported using Case-Express are assigned a lower priority than cases opened through Technical Support. For priority issues, open a support case with Technical Support (http://www.sybase.com/support).

by the way, with 11.0.1.2452 it works ok.

Answers (1)

Answers (1)

Former Member

Hi,

I've tested 11.0.1.2467 using Visual Studio 2005 / 2008 / 2010 for all .NET Framework versions ( 2.0 / 3.0 / 3.5 / 3.5 Client Profile / 4.0 / 4.0 Client Profile ), but I was not able to reproduce this problem. We have testing code which covers this scenario. We've never seen this problem.

I don't know why you got this error. It's probably caused by some version problems. I would suggest reinstall SQL Anywhere and check the GAC and machine.config.

Former Member
0 Kudos

I did it in my machine, in a fresh new virtual machine and at a co-worker machine...