0

web.config

<connectionStrings>
<add name="Conn" connectionString="Dsn=odbc_OnlineAcc;uid=sa;pwd=12345" providerName="System.Data.Odbc"/>
</connectionStrings>

C#

string connect =ConfigurationManager.AppSettings["Conn"];
        OdbcConnection odbcConnection = new OdbcConnection(connect);
        odbcConnection.Open();

error message is "connection property is not initiated";
How can I solve it?
Thanks to all................

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by alam14_mist
0

try changing the connect string of ConfigurationManager to:

string connect = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;

All the rest stays the same. If the connection string is correct, this has to work.

Edited by Mitja Bonca: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.