开发者

TableAdapter wizard does not have connection string from Settings in pick list

C# VS 2010 .net v4.0

I add a DataSet开发者_JAVA技巧 to my project (Class Library) and when I try to add a TableAdapter the connection string that I have added to Settings is not available to select. I have connection strings for other datasources (from server explorer) available. I can't use a work around, I NEED to pull the connectionstring from Settings. I do this same thing in many other projects and it usually works, though sometimes I just do random things until I can finally see my connection string. I was hoping the upgrade to vs2010 would fix this. Hopefully someone has seen this and can help, thanks.


have you checked the namespace of your project and dataset's designer class? make sure both are same ...


Did the OP ever solve this problem?

I recently had this exact same issue in Visual Studio 2015 (VS2015) and Visual Studio 2017 (VS2017). In previous projects, when adding a DataSet and configuring the TableAdapter, the wizard would show ConnectionStrings that were configured in the Project Settings (which are stored in the app.config. The wizard page would show the name of the string from settings, and the word (Settings) after it to indicate where it came from, as seen here:

TableAdapter wizard does not have connection string from Settings in pick list

However, in a recent project, it would not show the ConnectionStrings from the Project Settings.

It turns out, that in my case, I had copied a previous similar project to use as a shell to start the new project. This included the app.config. I had manually edited a bunch of the files to reflect what was needed for the new project, including the connection string, and I had inadvertently REMOVED a vital value, which was the providerName.

In the app.config, in the ConnectionStrings section, each string needs to specify the name, the ConnectionString AND the providerName. I had accidentally removed the providerName value. Here is an example of the correct settings in app.config

<connectionStrings>
    <add name="MembershipCRM.Properties.Settings.app_ogca_CRMConnectionString"
        connectionString="Data Source=MYSERVERNAME\SQL2014;Initial Catalog=app_ogca_CRM;Integrated Security=True"
        providerName="System.Data.SqlClient" />
    <add name="MembershipCRM.Properties.Settings.app_ogca_QBIConnectionString"
        connectionString="Data Source=MYSERVERNAME\SQL2014;Initial Catalog=app_ogca_QB;Integrated Security=True"
        providerName="System.Data.SqlClient" />
</connectionStrings>

Without the providerName value, indicating which kind of data source the ConnectionString refers to, the TableAdapter Configuration Wizard doesn't think it is valid, and will ignore it. As soon as I added the providerName="System.Data.SqlClient" value back, the wizard immediately picked it up.


I had the same issue with vb.net, .net 3.5 and sql 2008. What I did to resolve the issue was go to event viewer and clear the application log. My application log was full. Once I cleared the log I could add and view data connections.


I had the same issue. I solved my problem by removing and old reference to the System.dll in the csproj file. screen capture

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜