Hi All,

I'm stuck regarding to grab connection from app.config file...i'm surf many type and kind to do it..but still can',t.....i need to connect into two database (oracle n firebird).....how to do this..hope u all can help me....tq

Recommended Answers

All 2 Replies

>I'm stuck regarding to grab connection from app.config file

1. Add the reference of System.Configuration.dll assembly and Import System.Configuration namespace.
2. Use following code,

...
 str=ConfigurationManager.ConnectionStrings("CnStr").ConnectionString
...

Is there is any need to change |DataDirectory| wrtn in app.config file to any drive name like F: or C:
becz geting connection string from config file sometimes it givs binding exception or sometimes it return inappropriate data. Normal manual connection string works fine. Wats the prob?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.