ExecuteArray with an array like this DateTime?[] fails

ExecuteArray with an array like this DateTime?[] fails

Postby bconstantin » Thu 28 Apr 2011 00:02

With the latest version - 6.10.141.0
I have this array
DateTime?[] DATEARRAYORA = new DateTime?[NoOfRecords];
Some of the values are null in it.
Than I do this
cmd.Parameters.Add("v3", Devart.Data.Oracle.OracleDbType.TimeStamp).Value = DATEARRAYORA ;

Then cmd.ExecuteArray(NoOfRecords);

And I get this error - please note that this was working fine in the previous version

lid cast from 'System.DateTime' to 'System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
at System.DateTime.System.IConvertible.ToType(Type type, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Devart.Data.Oracle.OracleParameter.a(ay& A_0, Boolean A_1, Boolean A_2, OracleCommand A_3, Byte[] A_4, Hashtable A_5, a3 A_6)
at Devart.Data.Oracle.OracleCommand.a(OracleParameterCollection A_0, ay[] A_1, cj A_2, a3 A_3)
at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
at Devart.Data.Oracle.OracleCommand.ExecuteArray(Int32 iters)
Last edited by bconstantin on Thu 28 Apr 2011 13:22, edited 1 time in total.
bconstantin
 
Posts: 8
Joined: Wed 27 Apr 2011 23:47

Works with the previous verions - 6.0.58.0

Postby bconstantin » Thu 28 Apr 2011 13:21

Works with the previous verions - 6.0.58.0, but not with 6.10.141.0
bconstantin
 
Posts: 8
Joined: Wed 27 Apr 2011 23:47

Postby Shalex » Fri 29 Apr 2011 13:05

I cannot reproduce the problem with dotConnect for Oracle v 6.10.141 using the following code:
Code: Select all
// CREATE TABLE TSTABLE (
//   TSCOLUMN TIMESTAMP(6)
// );

    int NoOfRecords = 100;
    DateTime?[] DATEARRAYORA = new DateTime?[NoOfRecords];
    using (OracleConnection conn = new OracleConnection()) {
        //conn.ConnectionString = "server=orcl1120;uid=***;pwd=***;";
        conn.ConnectionString = "Direct=true;server=dboracle;SID=orcl1120;uid=***;pwd=***;";
        conn.Open();
        OracleCommand cmd = conn.CreateCommand();
        cmd.CommandText = "insert into tstable values (:p1)";
        cmd.Parameters.Add("p1", OracleDbType.TimeStamp).Value = DATEARRAYORA;
        cmd.ExecuteArray(NoOfRecords);
    }

Please tell us your mode (OCI or Direct) and the way we should modify this sample to reproduce the issue in our environment. Your .NET Framework is of the 4.0 version, isn't it?
Shalex
Devart Team
 
Posts: 7535
Joined: Thu 14 Aug 2008 12:44

Postby bconstantin » Sat 30 Apr 2011 00:11

This is the connection string that I use,
providerName="System.Data.EntityClient" />

This is how I set the connection and the transaction

DataContext.Connection.Open();
Devart.Data.Oracle.OracleConnection conn = (Devart.Data.Oracle.OracleConnection)((System.Data.EntityClient.EntityConnection)DataContext.Connection).StoreConnection;
Devart.Data.Oracle.OracleTransaction trans trans = conn.BeginTransaction();


Devart.Data.Oracle.OracleCommand cmd = new Devart.Data.Oracle.OracleCommand("", conn, trans);
bconstantin
 
Posts: 8
Joined: Wed 27 Apr 2011 23:47

Postby Shalex » Wed 04 May 2011 17:15

1. I cannot reproduce the problem with OracleTransaction and StoreConnection of EF model as well. Can you reproduce the problem without using StoreConnection? Please try the code I have posted in the previous answer. If it works, try modifying it to reproduce the issue without using EF model (just plain ADO.NET).
2. Tell us the version of your Oracle Server.
3. Does the problem persist with dotConnect for Oracle v 6.30.145 Beta?
Shalex
Devart Team
 
Posts: 7535
Joined: Thu 14 Aug 2008 12:44

seems to work with version 6.50.250.0

Postby bconstantin » Mon 05 Dec 2011 22:22

Just installed version 6.50.250.0 and it seems to work
bconstantin
 
Posts: 8
Joined: Wed 27 Apr 2011 23:47


Return to dotConnect for Oracle