The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

UdtTypeName error when not using UDTs for MSAccess provider

Last post 08-05-2008, 12:12 PM by David.Parsons. 2 replies.
Sort Posts: Previous Next
  •  08-05-2008, 9:36 AM 10566

    UdtTypeName error when not using UDTs for MSAccess provider

    Hello all,

     I'm using an MSAccess provider with no UDTs but I'm getting the following exception when I try to load my collection.


    Message - UdtTypeName property must be set for UDT parameters.
    StackTrace -    at EntitySpaces.Interfaces.esDataProvider.esLoadDataTable(esDataRequest request, esProviderSignature sig)
       at EntitySpaces.Interfaces.esDynamicQuery.Load()
       at MyNamespace.esMyEntity.LoadByPrimaryKeyDynamic(String myKey)
       at MyNamespace.esMyEntity.LoadByPrimaryKey(String myKey)
       at MyNamespace.MyClass.MyMethod()

    I've included my calling code below, as well as a snippet from my metadata and my database fields. (Entity names have been changed for security.) I've looked for this message on google and only got 4 hits. I also did not find this issue addressed in the entity spaces forums. There were a couple of issues that produced the same error message, but they did not appear to be applicable in this scenario. The only thing I can think of is if there are issues with mapping an Access OLE Object to a C# System.Byte[].  (Entity Spaces version 2007.1.1210.0.)

    Any insight would be appreciated.

    Cheers,

    Nathan

     

    Code:
    MyEntityCollection MyEntityCollection = new MyEntityCollection();
    MyEntityCollection.Query.Where(MyEntityCollection.Query.Or(MyEntityCollection.Query.MyStatusString.Equal(MyStatusClass.String1), 	
    
    MyEntityCollection.Query.MyStatusString.Equal(MyStatusClass.String2)), MyEntityCollection.Query.MyBoolean.Equal(false));
    MyEntityCollection.Query.Load();
     
    Code:
    esProviderSpecificMetadata meta = new esProviderSpecificMetadata();
    				
    meta.AddTypeMap("my_key", new esTypeMap("Text", "System.String"));
    meta.AddTypeMap("my_data", new esTypeMap("OLE Object", "System.Byte[]"));
    meta.AddTypeMap("my_status", new esTypeMap("Text", "System.String"));
    meta.AddTypeMap("my_dt", new esTypeMap("DateTime", "System.DateTime"));
    meta.AddTypeMap("my_other_key", new esTypeMap("Text", "System.String"));
    meta.AddTypeMap("my_boolean", new esTypeMap("Yes/No", "System.Boolean"));
     

    MS Access database table MyEntity
    my_key   Text
    my_data   OLE Object
    my_status  Text
    my_dt   Date/Time
    my_other_key  Text
    my_boolean  Yes/No


     

  •  08-05-2008, 11:51 AM 10571 in reply to 10566

    Re: UdtTypeName error when not using UDTs for MSAccess provider

    What does your OLE Object field contain?

    I've stored GIFs, JPGs, PDFs, Excel Worksheets, and text files in an OLE Object column using the Access UI, and successfully loaded them with EntitySpaces. EntitySpaces, of course, has no specific handlers for those file types. That column just loads as an arrays of bytes, but it does load.


    David Neal Parsons
    www.entityspaces.net
  •  08-05-2008, 12:12 PM 10572 in reply to 10571

    Re: UdtTypeName error when not using UDTs for MSAccess provider

    You might try not loading the OLE Object field, to help narrow down if that field is the problem. For ES2008 that's easy

    Code:
    MyEntityCollection.Query.SelectAllExcept(MyEntityCollection.Query.MyData);

    But, in ES2007 you could quickly test it with:

    Code:
    MyEntityCollection.Query.Select(MyEntityCollection.Query.MyStatusClass);

    BTW, your stack trace shows LoadByPrimaryKey, but since your are using DynamicSQL mode, the results should not be any different than for the Query.Load() code you posted.

    The other way you can get that error is to Generate against MS Access Northwind, then try to run your code against SQL Server Northwind, without generating a MetadataMap, and using Multi-provider mode. The Access data types will look like UDTs to SQL Server.


    David Neal Parsons
    www.entityspaces.net
View as RSS news feed in XML