Cannot Convert error.

Cannot Convert error.

Postby kathylaw725 » Mon 23 Nov 2009 22:03

I have installed version 5.35.54. Using Oracle 10g in VS2008.

I have a table where one of it's columns is of type NCLOB.

Using EF, we have a conceptual model generated from the database.

When inserting a new row onto that table, whenever the NCLOB is set (in C#, the type is String), I've got a "Cannot Convert" error in the provider when SaveChanges is called.

Am I doing something wrong?
kathylaw725
 
Posts: 1
Joined: Fri 20 Nov 2009 01:04

Me too

Postby skingaby » Tue 24 Nov 2009 02:58

I do not have a clob. I do have this table:
Code: Select all
CREATE TABLE DEAL
(
    DEAL_ID               NUMBER(10,0)   NOT NULL,
    DATE_ENTERED          DATE           DEFAULT sysdate NOT NULL,
    DATE_OF_DEAL          DATE           DEFAULT sysdate NOT NULL,
    FLOW_DATE_START       DATE           NOT NULL,
    FLOW_DATE_END         DATE           NOT NULL,
    DEAL_NUMBER           NUMBER(10,0)       NULL,
    BUS_ASSOCIATE_ID      VARCHAR2(10)       NULL,
    SUPPLY_CONTACT_ID     NUMBER(10,0)       NULL,
    CONTACT_OTHER         VARCHAR2(50)       NULL,
    MO_CONTACT_ID         NUMBER(10,0)       NULL,
    PIPELINE_ID           VARCHAR2(10)       NULL,
    ZONE_ID               NUMBER(10,0)       NULL,
    LOCATION_ID           VARCHAR2(10)       NULL,
    TRANSFER_POINT_ID     VARCHAR2(10)       NULL,
    DEAL_TYPE_ID          NUMBER(10,0)   NOT NULL,
    SUPPLY_CONTRACT_ID    VARCHAR2(10)       NULL,
    GMS_BROKER_ACCT_NBR   VARCHAR2(13)       NULL,
    RATE_PLAN_ID          VARCHAR2(10)       NULL,
    PROMOTED              NUMBER(1,0)    DEFAULT 0 NOT NULL,
    DELIVERED             NUMBER(1,0)    NOT NULL,
    CANCELED              NUMBER(1,0)    DEFAULT 0 NOT NULL,
    DEAL_TERMS_CHANGED    NUMBER(1,0)    DEFAULT 0 NOT NULL,
    DEAL_COMMENT          VARCHAR2(1000)     NULL,
    LOCKED_BY             VARCHAR2(8)        NULL,
    ENTERED_BY            VARCHAR2(8)    NOT NULL,
    LAST_UPDATE_USER      VARCHAR2(8)    NOT NULL,
    LAST_UPDATE_TMS       DATE           DEFAULT sysdate NOT NULL,
    NEED_ACCOUNT          NUMBER(1,0)    DEFAULT 0 NOT NULL,
    RESUBMITTED           NUMBER(1,0)    DEFAULT 0 NOT NULL,
    STORAGE_TRANSFER      NUMBER(1,0)    DEFAULT 0 NOT NULL,
    MO_CONTACT_OTHER      VARCHAR2(50)       NULL,
    SPECIAL_CONDITIONS    VARCHAR2(1000)     NULL,
    HAS_ATTACHED_SHEET    NUMBER(1,0)    DEFAULT 0 NOT NULL,
    ROW_VERSION           NUMBER(10,0)   DEFAULT 1 NOT NULL,
    DEAL_CONFIRMATION_ID  NUMBER(10,0)       NULL,
    DEAL552CODE_ID        VARCHAR2(10)       NULL,
    FLOW_DATE_START_YEAR  NUMBER(4,0)    NOT NULL,
    FLOW_DATE_START_MONTH NUMBER(2,0)    NOT NULL
)


And in this unit test:
Code: Select all
public void AddADeal()
{
   var em = new Entities();
   var deal = new Deal
               {
                  DealTypeId = 1,
                  DateEntered = DateTime.Today,
                  DateOfDeal = DateTime.Today,
                  FlowDateStart = DateTime.Today,
                  FlowDateEnd = DateTime.Today,
                  EnteredBy = "SAMPLE",
                  LastUpdateUser = "SAMPLE",
                  LastUpdateTms = DateTime.Now,
                  RowVersion = 1
               };
   var id = deal.DealId;
   em.AddToDeals(deal);
   var result = em.SaveChanges();
   Assert.IsTrue(result>0);
   Assert.AreNotEqual(id, deal.DealId);
}


I get the Can Not Convert error on this line:
Code: Select all
var result = em.SaveChanges();


Here is the content of the error:
Code: Select all
{"An error occurred while updating the entries. See the InnerException for details."}
Stack Trace:    at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
   at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
   at System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)
   at System.Data.Objects.ObjectContext.SaveChanges()
   at Model.ServerModelEF.Test.DealEfTest.AddADeal() in C:\_dev\Model.ServerModelEF.Test\DealEFTest.cs:line 47

InnerException:  {"An error occurred while preparing the command definition. See the inner exception for details."}
Stack Trace:     at System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree)
   at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand(UpdateTranslator translator, Dictionary`2 identifierValues)
   at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues)
   at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)

Inner Exception: {"Can not convert."}
Stack Trace:   at Devart.Data.Oracle.OracleUtils.a(Object A_0, OracleDbType A_1, Boolean A_2)
   at Devart.Data.Oracle.OracleParameter.c(Object A_0)
   at Devart.Data.Oracle.OracleParameter.get_OracleValue()
   at Devart.Data.Oracle.Entity.c.Clone()
   at Devart.Data.Oracle.Entity.h.a.o()
   at System.Data.Common.DbCommandDefinition.CreateCommandDefinition(DbCommand prototype)
   at System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommand prototype)
   at Devart.Data.Oracle.Entity.OracleEntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
   at System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree)
   at System.Data.Common.DbProviderServices.CreateCommand(DbCommandTree commandTree)
   at System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree)


I installed the new devArt today. Because I was getting errors, I recreated my EF diagram from scratch (yeuch) in your EF Designer tool. I have some unit tests that read the data that are passing. The Add is failing though. Please help.
skingaby
 
Posts: 32
Joined: Thu 14 May 2009 16:17

Postby AndreyR » Tue 24 Nov 2009 13:44

Thank you for the report, I have reproduced the problem.
I will let you know as soon as our investigation is finished.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby halley73to » Thu 26 Nov 2009 07:53

News?
halley73to
 
Posts: 29
Joined: Wed 07 Oct 2009 07:24

Postby AndreyR » Thu 26 Nov 2009 09:42

The problem is fixed. The fix will be included in the nearest build.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby halley73to » Thu 26 Nov 2009 10:05

How nearest? :-)
halley73to
 
Posts: 29
Joined: Wed 07 Oct 2009 07:24

Postby AndreyR » Fri 27 Nov 2009 09:32

We plan to release a new build in two weeks or so.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby halley73to » Fri 27 Nov 2009 10:00

Ok, thanks, we go back to the older version
halley73to
 
Posts: 29
Joined: Wed 07 Oct 2009 07:24

Postby AndreyR » Wed 02 Dec 2009 16:03

The new build is available for download.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby skingaby » Wed 09 Dec 2009 03:45

The newest build has fixed this problem for me. Thanks!
skingaby
 
Posts: 32
Joined: Thu 14 May 2009 16:17


Return to dotConnect for Oracle