Moving of the schema form Windows Forms 2.0 application to ASP.NET 2.0

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

Moving of the schema form Windows Forms 2.0 application to ASP.NET 2.0

 

Problem Description

 

Assume you created the project based on project template Windows Forms application. Assume also that this project contains one schema (Dataset).

The dataset in ASP.NET 2.0 application contains by default the description for adapter for each defined table in the dataset.

 

Now, of you want to import such dataset in the other application of project type Web service (or just web application) the web application will not build.

 

Workaround

 

The problem is that the XSD file describing the schema embeds connection string information, which is used for adapters.

 

Following code snippet shows how this information is created in the dataset generated by WindowsForms application:

 

          <Connection AppSettingsObjectName="Settings"              

              AppSettingsPropertyName="MyConnectionString"

              ConnectionStringObject=""

              IsAppSettingsProperty="True"

              Modifier="Assembly"

Name="MyConnectionString (Settings)"                    ParameterPrefix="@PropertyReference="ApplicationSettings.MyProject.Properties.Settings.GlobalReference.Default.MyConnectionString" Provider="System.Data.SqlClient">

          </Connection>

 

When you move the dataset file to the web application (designer file is not required), the specified connection string cannot be found in the application settings and the solution will not build.

 

To solve the problem, open the XSD file after importing in the web application and change the connection as shown bellow:

 

<Connection

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

 

To understand what here happen, I recommend creating of two projects. One of type WindowsForms-project and one ASP.NET project. Create one very simple schema in both of them and look for differences between ConnectionString settings.

http://www.daenet.de

Posted Mar 03 2006, 04:02 AM by Damir Dobric
Filed under:

Comments

twlwczpny wrote re: Moving of the schema form Windows Forms 2.0 application to ASP.NET 2.0
on 09-07-2012 21:49

2oeHga  <a href="xuancniweaux.com/.../a>, [url=http://rskpjedehbar.com/]rskpjedehbar[/url], [link=http://kaduhltmhojw.com/]kaduhltmhojw[/link], http://kcsjuknhwscy.com/

developers.de is a .Net Community Blog powered by daenet GmbH.