Unable to find connection 'MyConnName' for object 'Web.config' in Table Adapter configure Properties
Asked Answered
K

5

4

I want to change the query in table adapter but it's not opening & throwing an error "Configure table Adapter Failed" & in property of connectionString it says "Unable to find connection 'ConnStringName' for object 'Web.config'. The connection string could not be found in application settings, or the data provider associated with the connection string could not be loaded" getting this on making VPN connection

When Trying to open Configure

Error in property

Ken answered 18/10, 2016 at 6:53 Comment(2)
the same solution is showing connectionstring & opening the configure at another system but not at mine.Ken
If the following solutions didn't work, this is another solution that might be helpful https://mcmap.net/q/1664395/-visual-studio-2017-the-connection-string-could-not-be-found-in-application-settingsFredia
F
14

I have been looking for a solution for this problem for a long time. Thankfully I found a solution that worked for me.

  1. Close the dataset window with the error.
  2. Right click the dataset in the solution explorer.
  3. Select “Open with…” from the context menu.
  4. Select “Source Code (Text) Editor” from the list and press the “OK” button.

Near the top of the file, you’ll see a element with several elements within it. Most datasets should only have one element. If you are having trouble like I’ve described above, you’ll have at least two and one will be incorrect. Delete it or otherwise fix it, save the file and reopen normally.

This is the page where I found it out. See the complete answer here

Frissell answered 21/9, 2017 at 21:15 Comment(1)
Thanks for your good answer. In addition we need to modify the DefaultConnectionIndex to be 0Palfrey
P
1

I faced the same problem which is actually a nightmare and triyed Lorena solution and it was not enough to solve the problem. The missing part is to modify the Dataset using the XML editor changing the DefaultConnectionIndex to be 0 like this:

<DataSource DefaultConnectionIndex="0" 
FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, 
Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas- 
microsoft-com:xml-msdatasource">

thanks to Don who pointed this https://social.msdn.microsoft.com/Forums/windows/en-US/08a48cad-619d-4421-b584-f2b5550ba6c5/dataset-designer-quotunable-to-find-connection-myconn-mysettings1-for-object-mysettingsquot?forum=winformsdatacontrols

Palfrey answered 14/9, 2022 at 20:38 Comment(0)
A
0

Seems like there no ConnStringName parameter in connectionString section of Web.config

<connectionStrings> 
    <add name="ConnStringName" providerName="" connectionString=""/>
</connectionStrings>

Updated: The problem is in missing reference to System.Data.OracleClient. To solve this just add reference on missing provider.

Arytenoid answered 18/10, 2016 at 7:5 Comment(5)
I Have made the connectionstring like below.... same solution is working nicely at another system. <connectionStrings> <add name="ConnName" connectionString="Data Source=abc;Persist Security Info=True;User ID=BO_REPT;Password=rept_bo;Unicode=True" providerName="System.Data.OracleClient"/> </connectionStrings> But still I am not able to do.Ken
Have you added OracleClient reference to project?Arytenoid
If problem is not in connection string, possible problem is missing reference to System.Data.OracleClientArytenoid
System.Data.OracleClient it was already present in the provider name in the webconfig file & as a reference in the solution too, but still I am unable to get the connection in any of the table adapter.Ken
Let us continue this discussion in chat.Ken
L
0

Well Same problem I faced in Windows Forms, I just opened Settings.settings file, found the "ConnectionString" and repaired it. (As you click in Value field of ConnectionString a button [...] appears in last of Value field click it and repair/test your connection again, in my case I re-entered password again.) . Hope This Helps.!

Lorenzen answered 30/4, 2020 at 8:17 Comment(0)
H
0

ConnStringName is case-sensitive.

Hoxsie answered 5/7, 2022 at 16:56 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Butterfly

© 2022 - 2024 — McMap. All rights reserved.