how to get connection string from app.config in vb.net
  • how can i get my app.config connectionstring in vb.net.
  • 1 Comment sorted by
  • Vote Up0Vote Down ithackerithacker
    117.50 Karma Accepted Answer
    hi coder use this code.

    app.config code

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <configSections>
      </configSections>
      <connectionStrings>
        <add name="dbAccountsConnectionString"
            connectionString="Data Source=.\sqlExpress;Initial Catalog=dbAccounts;Integrated Security=True"
            providerName="System.Data.SqlClient" />
      </connectionStrings>
    </configuration>

    Form1.vb code


    Dim conStr As String = System.Configuration.ConfigurationManager.ConnectionStrings("dbAccountsConnectionString").ConnectionString

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

    Optimum Creative