You must Sign In to post a response.

connection string in wpf

I am new to wpf,please explain how to make connection string in app.xaml file.


Comments

#285577    Author: Aravind PK    23 Aug 2008 Member Level: Gold   Points : 4

Use app.config to create connection string as how you may use in web.config file for connection settings in web based apps.

it can be like,
<appsettings>
<add key=".[your connection string key name you choose to have]." value="..[connection string value]..">
</appsettings>

#286626    Author: ParasGautam  25 Aug 2008 Member Level: Bronze   Points : 6

Hey Thanks for replying,but I tried the solution you gave,I put <appsetting> tag in app.xaml file like

<Application x:Class="WpfBinding.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml">
<Application.Resources>
<appsetting></appsetting>
</Application.Resources>

</Application>

But it gives the following error:-

Error1: The tag 'appsetting' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentat

Error2:The type 'appsetting' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

plese help


This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.