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................

Recommended Answers

All 2 Replies

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.

Thank you.....................Mitja.

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.