Skip to Content
avatar image
Former Member

'out of range for destination' Exception with DateTime.UtcNow in Select clause

Hi,

Next code throws 'iAnywhere.Data.SQLAnywhere.SAException: 'Value 20171110 out of range for destination'' exception :

SAConnection myConnection = new SAConnection("Server=DBSERVER;DBN=DBNAME;UID=*******;PWD= *****;Links=tcpip(Host=DB-SYBASE);");

myConnection.Open();

SACommand myCommand = myConnection.CreateCommand();

myCommand.CommandText = "SELECT column1, ? FROM TABLE ";

SAParameter parm = new SAParameter();

parm.SADbType = SADbType.DateTime;

parm.Value = DateTime.UtcNow;

myCommand.Parameters.Add(parm); SADataReader myDataReader = myCommand.ExecuteReader();

I tried with SqlAnywhere16 provider but also with previous versions.

Please, can you explain me why it generates this exception?

Thanks,

Davide

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 17, 2017 at 09:19 AM

    1.What build are you using?

    Please see the below for details.
    2320846 - How to confirm version of SQL Anywhere

    2.What version of the .net data provide?
    (Sap.Data.SQLAnywhere.v3.5, Sap.Data.SQLAnywhere.v4.5, etc...)

    3.What version of the target framework?

    thanks

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 28, 2017 at 11:06 AM

    I use iAnywhere.Data.SQLAnywhere.v4.0.dll build 11.0.1.29604. The target framework is .NET 4.0.

    Can you reproduce the issue with my test program and this settings?

    Thanks

    Add comment
    10|10000 characters needed characters exceeded