on 2010 Aug 03 8:32 PM
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
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
53 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.