CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    121

    Question Clean way to check if database connection is open?

    sqlConnection.State.ToString().Equals( "Open" )

    There has to be a cleaner way to check the state of SqlConnection (???)
    Last edited by dky1e; June 3rd, 2002 at 12:10 PM.

  2. #2
    Join Date
    Feb 2002
    Location
    Spain
    Posts
    148
    Hi:

    Yes!! Of course. Try this:

    if (m_Connection.State == ConnectionState.Open)
    ...do what ever needs to be done if the collection is open...

    m_Connection is the instance of the connection class.

    VictorL

  3. #3
    Join Date
    May 2002
    Posts
    121

    Smile

    Nice...
    I knew threre was a better way !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured