Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lesley 107 posts 349 karma points
    Mar 01, 2021 @ 03:29
    Lesley
    0

    How to register and connect to a stand-alone database via NPoco

    We are currently registering a stand-alone SQL Server database in our composer using

    composition.RegisterUnique(typeof(IDatabase), new Database("registerDSN"));
    

    However, we are getting connection errors:

    ExecuteReader requires an open and available Connection. The connection's current state is connecting.
    

    What is the correct way to register the connection for use with DI so that handles opening and closing connections correctly?

  • AddWeb Solution Pvt. Ltd 109 posts 360 karma points
    Mar 02, 2021 @ 07:06
    AddWeb Solution Pvt. Ltd
    0

    Hello,

    Before Executing any Sql Query make sure that your connection of Application with DataBase is Open Refer this link :- https://stackoverflow.com/questions/9705637/executereader-requires-an-open-and-available-connection-the-connections-curren

Please Sign in or register to post replies

Write your reply to:

Draft