none
Dataset Designer: "Unable to find connection MyConn (MySettings)1 for object 'MySettings'" RRS feed

  • Question

  • Everything was working well yesterday, but today when attempting to open and preview one of the queries of a tableadapter in my application's most crucial dataset, generates this error:

    "Operation failed."

    "Unable to find connection 'MyConn (MySettings)1' for object 'MySettings'. The connection string could not be found in application settings, or the data provider associated with the connection string could not be loaded. .'

     

    I've searched these forums, newsgroups, google and come across a few examples of where the dataset designer has inserted additional connection lines within the xsd. However, this doesn't appear to have happened here.

    If I get the latest stable build in its entirety from SourceSafe, I still have the same problem!

    If I get a very old build from SourceSafe, I still have the problem!

    This proves that there is nothing wrong with the xsd. Or, each time it is used, the Dataset designer goes off and does its own thing with it.

    I'm able to open and configure the Query and using the Query Builder, execute a test of the query - which does exactly what I would have expected from the "Preview Data" button.

    If I run the solution, no immediate problems. But calling the update method on one of the affected tables (although I get the error on ALL my datasets) at runtime (the solution compiles ok and runs) I get various SQL errors related to concurrency. One of my datasets bombs out when I attempt to open it with the above error, and additionally displays a critical message: "The specified procedure could not be found. (Exception from HRESULT: 0x8007007F).

    The solution is a VB.NET solution, and this is a data access layer .dll assembly. The connection string is stored in MySettings.

    Incidentally, I have tried to log a support incident with Microsoft, but can't as the online tool doesn't recognise my product ID when I type it in or use the downloadable tool. Does this indicate a potential problem with my VS2005 installation?

    Please help, I'm absolutely tearing my hair out! (And so is my client - the solution was opened to issue a hotfix!)

    Also my VS2005 installation, after 5-6 hours continuous work uses up around 1.5gb of RAM. Connected problems?

    Many thanks!

    (p.s. BRING ON VS2005 SP1!!!)

    Wednesday, August 30, 2006 11:54 AM

Answers

  • Helpful suggestions, thanks guys.

    Actually, a few days ago this support query with Microsoft was just closed, taking over two months to resolve.

    There was a duplicate connection string and it was in a different assembly, in a different dataset.

    This has been posted as a request for change to the Visual Studio team. And for future readers - heed the suggestions above in this topic and also bear in mind that the problem could be in a totally different dataset, check them all!

    Cheers,

    Mike

    Tuesday, November 14, 2006 12:45 PM

All replies


  • Check and see if it's a problem with the XSD file as described in the answer to the following post:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=105616&SiteID=1

    Wednesday, August 30, 2006 12:28 PM

  • OK, it looks like you may have attempted the above suggestion based upon the description in your post.

    Is the connection string entry that it's looking for actually in the App.config file for the application hosting the DLL?

    Wednesday, August 30, 2006 12:36 PM
  • I'm unable to respond to this post... for some reason "the administrator has disabled duplicate posts" (but it's not a duplicate post!)
    Wednesday, August 30, 2006 4:00 PM
  • Hi Paul,

    Thanks for your posts. I did try the suggestions on the link you mentioned, having seen that post before :) There are not likely to be any other posts that can be found via the conventional search engines (or msdn) that describe a solution to this problem.

    This is a Winforms app. One .exe assembly and this .dll which contains all the datasets. The Winforms app contains datasets that reference the datasets within the .dll.

    Everything has been fine with this project for over a year.

    The .exe which hosts the .dll doesn't have any connection strings in it at all.

    There is an app.config within the .dll which shows an element (the element is correct, I've had to remove database and assembly names though...):

    configuration/connectionStrings:

    <connectionStrings>

    <add name="DLLASSEMBLY.My.MySettings.MyConnString"

    connectionString="Data Source=bluewhale\SQLEXPRESS;Initial Catalog=DATABASE;Persist Security Info=True;User ID=II;Password=XXX"

    providerName="System.Data.SqlClient" />

    </connectionStrings>

    The odd thing is this problem has been resolved for many people by removing duplicate connectionString's. But I don't have more than one under the connectionStrings element...

    I have just now been reinstalling Visual Studio 2005 in full, (with plenty of reboots) from scratch. Problem still exists.

    Many thanks for your time!

    Wednesday, August 30, 2006 4:03 PM

  • So where is MyConn being used? Was this generated by one of your Data Sources?
    Wednesday, August 30, 2006 5:20 PM
  •  Paul P Clement IV wrote:

    So where is MyConn being used? Was this generated by one of your Data Sources?

    Sorry - MyConn = My Connection String. It all ties together, there's no obivous problem with the code. I had to change the code a bit before posting for security.

    There are no unused or duplicated connection strings. I could technically make a new dataset, but this will take a week to code and test. There's definately a MS bug here, and I'd like to log a support ticket.

    Wednesday, August 30, 2006 8:31 PM
  • I had this same problem this evening and when I looked at the code for my typed dataset, the dbsource line read like this:

    <DbSource ConnectionRef="TAAConnectionString (Web.config)" DbObjectName="TAA.dbo.itaApplicants" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="True" GeneratorGetMethodName="GetApplicants" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetApplicants" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetApplicants" UserSourceName="Fill">

    I removed the (Web.config) in the ConnectionRef and it works. 

    Good luck!

    Laurie

    Tuesday, September 5, 2006 3:13 AM
  • Thanks Laurie,

    I tried that (removing (MySettings)), although it didn't work, and caused me more errors. This issue has been with Microsoft for several weeks now at Priority "B" classification and they're stumped too.

    Looks like a new VS2005 bug. To be honest, anything using the dataset designer is going to end in tears - it's a nightmare.

    Tuesday, September 19, 2006 8:52 PM
  •  

    Hi Mike,

    I had the same problem with one of my projects. If you open up the Dataset using the XML editor you should see a line near the top that looks like this:

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

    I changed the DefaultConnection Index from a 1 to a 0 and the problem went away. I suspect at one time I had two connections and one went away but the index was not updated.

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

    Hope this works for you

    Don

    Wednesday, October 4, 2006 2:54 PM
  • I had the same problem.

    the problem is: the name of the connectionString name in generated app.config file of the class library. 

    My suggestion is :

    1. add a new dataset to your class library. Ex. DataSet1.xsd.
    2. Add one table to this dataset from server explorer.
    3. Compile your library.
    4. Look at the settings file
    5. You will find now three connection strings. Two ( one is your old conString ) of them is in correct format. One, the old one is wrong format.
    6. Delete old one ( wrong formatted)
    7. build class library.
    8. Delete Dataset1.xsd.
    9. Open Settings file. Delete newly added one for DataSet1.

    Rebuild class library.

    Now it becomes formatted how the VS.2005 wants to see.

    I have corrected this Unable to find connection xxx for object 'xxx' error like this and all things worked now as it expected.

    Sunday, October 15, 2006 5:32 PM
  • Helpful suggestions, thanks guys.

    Actually, a few days ago this support query with Microsoft was just closed, taking over two months to resolve.

    There was a duplicate connection string and it was in a different assembly, in a different dataset.

    This has been posted as a request for change to the Visual Studio team. And for future readers - heed the suggestions above in this topic and also bear in mind that the problem could be in a totally different dataset, check them all!

    Cheers,

    Mike

    Tuesday, November 14, 2006 12:45 PM
  • I ran into the same problem. It appears that the DataAdapter designer had duplicated the connection string in the .xsd file.  Below you can see 3 of the 4 that I deleted. After deleting them (in Notepad) I saved the .xsd file and reloded it in VS2005. It now loads properly with only a single connection string??  Looks like a problem with VS to me.

    JCJ

    <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="NorthwindConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="NorthwindConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.NorthwindConnectionString.ConnectionString" Provider="System.Data.SqlClient">
              </Connection>
              <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="NorthwindConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="NorthwindConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.NorthwindConnectionString.ConnectionString" Provider="System.Data.SqlClient">
              </Connection>
              <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="NorthwindConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="NorthwindConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.NorthwindConnectionString.ConnectionString" Provider="System.Data.SqlClient">
              </Connection>

    Thursday, December 21, 2006 10:48 PM
  • It is a problem within VS2005, absolutely. However the support case was closed off with the required resolution and optionally more intuitive error message as a "feature request". The big problem for me was that Visual Studio entered in the duplicate connection strings into an unassociated xsd file of its own accord.

    Beware the dataset designer!

    Wednesday, December 27, 2006 2:38 PM
  • I had the same thing. The solution for me was to use some tool like Notepad++ search all of my XSD files to see if I could find any file that contained more than one <Connection> node. Sure enough 1 of my 14 files did and that did me in. So, follow Mike's advice, check all of you XSD files. 

     

     

    Saturday, July 7, 2007 3:12 AM
  • Visual studio somehow put a settings.vb in de root of the solution.data project.

    When i deleted this file everything worked fine again.

    Friday, February 15, 2008 11:54 AM
  •  

    Removing duplicates of the connection string in the.xsd file solved the problem for me as well!

     

    Thanks!

     

    Monday, March 3, 2008 1:01 PM
  • I had this same issue.  None of the suggstions here helped.  However if you notice from my connectionStrings setting block, the provider name was blank.  However that happened who knows but...

        <connectionStrings>
            <add name="RecipePro.My.MySettings.cookbookConnection" connectionString="Data Source=DT01\SQLExpress;Initial Catalog=cookbook;User ID=sa; Password="
                providerName="" />
        </connectionStrings>
        <connectionStrings>
            <add name="RecipePro.My.MySettings.cookbookConnection" connectionString="Data Source=DT01\SQLExpress;Initial Catalog=cookbook;User ID=sa; Password="
                providerName="System.Data.SqlClient" />
        </connectionStrings>

    By adding the correct provider name, the problem was resolved.  Hope this helps the next developer in his struggle with VS!

    What caused this issue was when I changed the app.settings.connection from application to user since when it is set to application, it is read only.  I changed it to user so I could specify different data sources on application launch.
    • Edited by Chris Gifford Saturday, August 29, 2009 10:46 PM Provide actual cause for bug in visual studio
    Saturday, August 29, 2009 10:22 PM
  • Thank you all for the solutions above. It's been almost three years since the original post, and I still ran into this problem now.

    The VS2005 dataset designer wouldn't find the connection string for existing table adaptors and was unable to modify the XSD.

    I finally found out that in my project the connection string has to be set in two places in the web.config, in both connectionStrings and applicationSettings. Now the dataset designer works again!


    <configuration>

         <connectionStrings>
            <add name="ConnectionString1"
                connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=pathtofile.mdb;Persist Security Info=True"
                providerName="System.Data.OleDb" />
        </connectionStrings>

        <applicationSettings>
            <WebService.My.MySettings>
                <setting name="ConnectionString1" serializeAs="String">
                    <value>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=pathtofile.mdb;Persist Security Info=True</value>
                </setting>
            </WebService.My.MySettings>
        </applicationSettings>

    Wednesday, October 21, 2009 1:39 PM
  • I re-ran into this issue recently, but no duplicate connection strings anywhere to be found.  After a bit of investigation, I determined another cause for this unhelpful error message:

    If you've defined ANY settings that use a custom settings provider in the same project where the datasets reside, the designer is unable to read the connection string.

    The tight coupling between the dataset designer and the (very brittle) settings machinery is the cause of most of these nightmares.

    FWIW, I've opened an item on Connect suggesting that the dataset designer be released to Codeplex as open source, since MSFT doesn't seem very interested in maintaining it.  You can vote on it here if you are inclined:

    https://connect.microsoft.com/VisualStudio/feedback/details/543231


    -cd [VC++ MVP] Mark the best replies as answers!
    Saturday, April 3, 2010 4:34 PM
  • Hi, just found it was on my project.

    The problem was the duplicated connection string BUT it was not in web.config, it was on my .xsd , open the file by View Code mode and on the top had the duplicated connection strings.

    Hope this can help.

    Regards

    Tuesday, May 4, 2010 1:35 PM
  • If you could not solve your problem, the following link can help you:

    http://blog.dmbcllc.com/2009/03/18/unable-to-find-connectionfor-object-webconfig/

    Good luck!

    Tuesday, May 18, 2010 8:10 AM
  • I had the same problem

    The solution was : right click on the xsd file, and choose "open with " and select "XML (Text) Editor " I had to same connectionstring like this :

    <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="FarzanCMSConnectionString" ........... />
    <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="FarzanCMSConnectionString" ........... />

    Delete one of theme, and you are good to go.

    Hope this helps

    • Edited by Farzan mc Saturday, March 12, 2011 9:48 AM poor edit controls in first submition
    • Proposed as answer by M009 Sunday, December 25, 2011 12:18 PM
    Saturday, March 12, 2011 9:42 AM
  •  

    Hi Mike,

    I had the same problem with one of my projects. If you open up the Dataset using the XML editor you should see a line near the top that looks like this:

    <

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

    I changed the DefaultConnection Index from a 1 to a 0 and the problem went away. I suspect at one time I had two connections and one went away but the index was not updated.

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

    Hope this works for you

    Don


    Just ran into a variation of this particular issue.  I had to change -1 to 0 to solve it.  Interestingly, I was able to open an existing dataset for editing, and only encountered the error when attempting to save the changes.
    • Proposed as answer by M009 Sunday, December 25, 2011 12:10 PM
    Friday, March 25, 2011 2:40 PM
  • Thanks Dave, I ve solve my problem with your post....
    Tuesday, July 12, 2011 7:56 PM
  • In my case that was already 0 but still had the problem. But I could solve it this way.

    In project properties> Settings> I deleted the connection string that was mentioned in the error message. Then in the dataset designer I added a new tableadapter and in the wizard made another connection string with the same name of the one I deleted.

    Problem solved.

    Saturday, July 30, 2011 6:58 AM
  • This is still a problem in VS2010. It happened out of the blue in a previously working piece of code...

    I solved it in my case by editing the dataset xsd file with the XML editor and replacing all occurrences of "theconnectionstring (MySettings)" with "theconnectionstring".  Thanks for the suggestion, people.

    • Proposed as answer by Atle Bjanes Tuesday, September 13, 2016 3:55 PM
    Friday, November 4, 2011 3:59 PM
  • Hello Dave,

    I had the same problem, it occured when I renamed the connection string in the web.config file and used the "find & replace" function to rename it throughout the entire project.

    I used part of what you said to solve it, I open the dataset using the XML Text Editor, then at the top of the page there were 2 identical connections defined, but one of them contained an additional attribute called (ConnectionStringObject=""), I removed it and it all worked again!!

     

    <Connections>
         <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="dbConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="dbConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.dbConnectionString.ConnectionString" Provider="System.Data.SqlClient" />
         <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="dbConnectionString" IsAppSettingsProperty="true" Modifier="Assembly" Name="dbConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.dbConnectionString.ConnectionString" Provider="System.Data.SqlClient" />
    </Connections>
    


    I hope other can make use of my case here!!

    M009

     


    • Edited by M009 Sunday, December 25, 2011 12:18 PM
    • Proposed as answer by M009 Sunday, December 25, 2011 12:18 PM
    Sunday, December 25, 2011 12:17 PM
  • I'm surprised that no one mentioned the need to install all neccesary datasource drivers for Visual Studio. I ran into to same issue, but I had to install IBM Database Add-Ins for Visual Studio driver to activate DB2 datasource in VS. Hope this helps someone down the line.

    Kenny Kalejaiye
    BI Expert
    Target Corp., Minneapolis, Mn.

    Tuesday, May 8, 2012 5:00 PM
  • Don256,

    That's it, that was the problem for me.  Thanks!

    Tuesday, September 18, 2012 8:33 PM
  • Hi,

    Try this:

    I tried to add Connection from Database Explorer and I got error the my Event Log is full. I cleared it and that's all what worked for me. Good luck !

    Monday, November 19, 2012 10:47 PM
  • In my case had a corrupted version of my client ODAC.  What I did was install a new version of ODAC, I hope this solution help. No need to reinstall Visual Studio and SP1.

    Reviewing connections string on Dataset (XML), I have no duplicates.

    Client 11.1.0.1.0 (Corrupt)
    Name: OraClient11g_home1
    Folder: 11.2.0\Client_1

    Client 11.2.0.1.2 (new install)
    Name: OraClient11g_home2
    Folder: 11.2.0\Client_2

    Thursday, November 21, 2013 1:59 PM
  • I had the same problem but solved by editing DataSet1.xsd (code). There were 2 connectio string for the same purpose in section <Connections>. I removed last one and problem was magically over!!! Thanks social.msdn.   

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema id="DataSet1" targetNamespace="http://tempuri.org/DataSet1.xsd" xmlns:mstns="http://tempuri.org/DataSet1.xsd" xmlns="http://tempuri.org/DataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
      <xs:annotation>
        <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
          <DataSource DefaultConnectionIndex="1" FunctionsComponentName="QueriesTableAdapter" GeneratorFunctionsComponentClassName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" UserFunctionsComponentName="QueriesTableAdapter" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
            <Connections>
              <Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="YuvaParichayConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="YuvaParichayConnectionString (Settings)" PropertyReference="ApplicationSettings.YuvaParichay.Properties.Settings.GlobalReference.Default.YuvaParichayConnectionString" Provider="System.Data.OleDb" />

            <Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="YuvaParichayConnectionString" IsAppSettingsProperty="true" Modifier="Assembly" Name="YuvaParichayConnectionString (Settings)" PropertyReference="ApplicationSettings.YuvaParichay.Properties.Settings.GlobalReference.Default.YuvaParichayConnectionString" Provider="System.Data.OleDb" />
      

             </Connections>

    Tuesday, March 10, 2015 11:43 AM

  • Just had this problem and your fix worked!  (xsd modification of DefaultConnectionIndex from 1 to 0)  Thank you Mike!
    • Edited by Davester34 Sunday, June 19, 2016 6:49 PM
    Sunday, June 19, 2016 6:48 PM
  • Mine showed " DataSource DefaultConnectionIndex="2" ", I changed it to 0 and problem was resolved. Thanks

    Clifford J Clark

    Tuesday, July 18, 2017 7:45 PM
  • After a lot of struggles, I have resolved the issue as just open .xsd file of my project, open the properties of TabelAdopter of a table and under Connection, none the Name of Connection and again select a connectionName from dropdown list and repeat with all adopters and going well.
    Wednesday, February 28, 2018 3:23 PM
  • I knew something didn't look right. I just replaced 79 occurrences of this and now it works perfect again. Right click on your dataset. Click 'Open With'. Click on "Source Code (Text) Editor" and you will see the bogus (Web.config) within.
    Thursday, October 4, 2018 3:49 PM