none
Entity framwork error when accessing EntityFramework data-connection from Access 2010 RRS feed

  • Question

  • Hi there.

    In my Visual-Studio 2010 Entity Framework project I have 3 components:

    1) A DLL with the entity model and business-logic and therefore the connectionString in the app.config.

    2) A DLL with GUI to test the entity model-DLL during development

    3) A MS Access 2010 programm which should call the the entity model-DLL in the end

    Testing with 1) and 2) is fine (after I discovered that it is necessary to put the connectionString in the app.config of the GUI-DLL also (this tip can be found in lots of forums)), access to the Database is o.k.

    Now I wanted to call the entity model-DLL from Access for further testing. I made the entity model-DLL COM-visible, referenced it in Access and configured everything that even intellisense works in Access with my DLL.

    Calling a function of the entity model-DLL works fine, if the function doesn't use database-access - functions without it are working.

    But when I call a function with database-access I get the error

    Runtime error '-2147024809 (80070057)':
    The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

    I have tried to put all DLLs together in one directory with the edmx-ressource-files - same error. I tried to use absolute instead of relative paths for the edmx-ressource-files in the app.config-files - same error...

    In the context of the Access program the access to the edmx-files seems not to work. I do not want to include the connectionString into the Access program - has anybody a solution to this problem?

    Many thanks in advance!

    Greetings Jeff

     

    Monday, August 15, 2011 9:50 AM

Answers

All replies

  • Hello,

    Regarding your description, I suspected that you package edmx files and config file into one DLL, but CLR cannot find it at runtime. As you can see here, http://msdn.microsoft.com/en-us/library/bb156503.aspx. The first parameter is the connection string's name which was coded your edm. I suggest you can copy the connection string into config file of your entire project and try it again.

    Thanks,


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 18, 2011 11:00 AM
  • Hello,

    thank you for yourt answer.

    Er, what is the 'config file of your entire project '? I have a project-folder with two projects (the testclient & the DLL with the entity model). Both have got the correct connectionString in their config-files.

    Do you mean the folder, where the .suo & .sln-files ad the two folders of the projects are? If so, what should the filename & extension of the file be - besides the 2 folders & the .suo & .sln-files there are no other files which are automatically created. Do you know, where I can find a documentation on this file(s) you are talking about?

    Thanks again.

    Greetings Jeff

     

    Monday, August 29, 2011 3:12 PM
  • Jeff, I think you should check this thread which was similar with yours. http://stackoverflow.com/questions/3491165/the-specified-named-connection-is-either-not-found-in-the-configuration-not-inte

    Thanks,

    Werewolf,


    Just a newbie for everything.
    Tuesday, August 30, 2011 7:56 AM
  • Hi Werewolf,

    your thead didn't help me, cause I call the dll from MS ACCESS, not a .NET-program.

    But I tried the following: copyied the app.config and renamed it to <name>.config, where <name> is the name of my Access-application and placed it in the directory with all other programs, dll's and config-files. Didn't work...

    Now I wrote a HelperClass that generates an instance of my ObjectContext-subclass which uses EntityConnection & EntityConnectionStringBuilder to generate the connection manually. Instead of just using instances of my ObjectContext-subclass I must use my HelperClass everywhere in the code. But it is working. Later I will use the connectionString in the config files in this HelperClass - and the I'm just doing the same that .NET does, but all manually...

    Greetings, Jeff

     

    Monday, September 26, 2011 7:34 AM