Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Dataset Designer: "Unable to find connection MyConn (MySettings)1 for object 'MySettings'"
 

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

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!!!)

Mike Wilson  Wednesday, August 30, 2006 11:54 AM

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 aduplicate 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

Mike Wilson  Tuesday, November 14, 2006 12:45 PM


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

Paul P Clement IV  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 actuallyin the App.config file for the application hosting the DLL?

Paul P Clement IV  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!)
Mike Wilson  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!

Mike Wilson  Wednesday, August 30, 2006 4:03 PM

So where is MyConn being used? Was this generated by one of your Data Sources?
Paul P Clement IV  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.

Mike Wilson  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

larkydoo  Tuesday, September 05, 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.

Mike Wilson  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 a1 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

Don256  Wednesday, October 04, 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.

hhascelik  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 aduplicate 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

Mike Wilson  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>

JJIII  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!

Mike Wilson  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 youXSD files.

kmccaa  Saturday, July 07, 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.

Patrique_77  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!

gnorky  Monday, March 03, 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 helpsthe next developer in his struggle with VS!

What caused this issue was when I changed the app.settings.connectionfrom 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 bycbGifford Saturday, August 29, 2009 10:46 PMProvide actual cause for bug in visual studio
  •  
cbGifford  Saturday, August 29, 2009 10:22 PM

You can use google to search for other answers

Custom Search

More Threads

• how to set the SqlParameter as field reference ?
• Sorting data - DataGridView
• Databind DataGridView HELP.....
• Currency in DataSet
• C# - How do I Export and Import DataGridView Contents?
• How to add a button to datagrid column
• combobox display member is not working over binding scenario
• How to code a procedure to select all items in list box?
• DataGridView CalendarColumn example doesn't handle keyboard input
• DataBindingComplete event firing incorrectly??