6 Answers, 1 is accepted
connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.
In web.config I have connection string!
Here is exception code :
OpenAccessException |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
System.Configuration.ConfigurationErrorsException: A connection string was referenced by name 'Connection' but could not be resolved through the web.c... |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
InnerExceptions |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FailedObject |
null |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BackendError |
null |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Reason |
Internal |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CanRetry |
False |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
HelpLink |
null |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Message |
System.Configuration.ConfigurationErrorsException: A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Data |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
InnerException |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TargetSite |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
StackTrace |
at Telerik.OpenAccess.RT.ExceptionWrapper.Throw() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Source |
Telerik.OpenAccess.Runtime |
Here is a blog post about using LinqPad with OpenAccess, although it is a bit outdated and refers to the "classic" approach of OpenAccess, not to the visual designer.
The exception you see means that the connection string with name "Connection" cannot be resolved from the configuration file of the currently executing assembly. In this case this assembly is the executable file of LinqPad, which I guess does not have your connection string in its configuration. To avoid this behavior you can pass the connection string directly to the OpenAccessContext's constructor. This way OpenAccess will not try to resolve it by name from the configuration file. The code would look like this:
EntitiesModel context =
new
EntitiesModel(
"FullConnectionStringHere"
);
Kind regards,
Alexander
the Telerik team
I read that blog before I post here for help, anyway your post helped me!
I have code :
StoreDB pgData = new StoreDB();
var c = from p in pgData.Objekats
select p;
c.Dump();
And with your corrections this is working code :
StoreDB pgData = new StoreDB("server=localhost;port=5432;database=store;user id=ITerp;password=iterp011");
var c = from p in pgData.Objekats
select p;
c.Dump();
I have web.config and Connection string in! It's Webservis and is working very well. I just want to try if I can query from linqpad. I setup linqpad with dll's and namespace's but can't read connection string from web.config. Maybe it can't work with webservis dll?
LinqPad is referencing your service dll as a class library in order to access the StoreDB and persistent classes, this assembly is not actually being executed and the service inside is not running. So the executing assembly, in which OpenAccess is looking for a connection string, is the LinqPad application itself. So if you need to use a connection string from a config file, you need to set it in the configuration file of LinqPad, which most likely is named LinqPad.exe.config. If there is no such file, you can create one.
Nevertheless, I believe the easier way is to just pass the connection string as parameter, as it seems to be working correctly.
Greetings,
Alexander
the Telerik team
I am also having issue with LinqPad querying a WCF service using OpenAccess. The service seems to be working but no matter how simple of a query I try to run I get this error in LinqPad, The type or namespace name 'DataManager' does not exist in the namespace 'LINQPad.User.Kiopia.BaseEntities'. BaseEntities is my OpenAccess model class.
Anyone else having this issue or got a work around?
Thanks,
Garry
Could you please give some more details about this missing DataManager - where are you using it and which assembly contains it? Please double-check that you have added a reference in LinqPad to this assembly. It would be helpful if you could send us the code you are trying to execute as well as the list of references you have added, so we can try to reproduce the error locally.
Greetings,
Alexander
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>