Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3356326
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:30:04+00:00 2026-05-18T02:30:04+00:00

I am working with Server object from Microsoft.SqlServer.Management.Smo namespace. How i can check that

  • 0

I am working with Server object from Microsoft.SqlServer.Management.Smo namespace.
How i can check that it connected successfully to the server i couldnt see there any property related to it .

                ServerConnection srvConn = new ServerConnection(server);
                // Log in using SQL authentication instead of Windows authentication
                srvConn.LoginSecure = false;
                // Give the login username
                srvConn.Login = serverUserName;
                // Give the login password
                srvConn.Password = serverPassword;
                // Create a new SQL Server object using the connection we created
                SqlServer = new Server(srvConn);

I want to know if connection was good with my username and password.

Thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:30:05+00:00Added an answer on May 18, 2026 at 2:30 am

    I believe that Smo doesn’t connect to the server until you actually use the connection for something. According to Books Online:

    SMO will automatically establish a
    connection when required, and release
    the connection to the connection pool
    after it has finished performing
    operations.

    That means you have two basic strategies:

    1. Retrieve Server.Information.Version or another attribute to test the connection
    2. Just go ahead and do what you want to do, and catch any exception

    I would say that 2 is the better option, because there is no guarantee that a connection that works now will work again in a few seconds: the server or network can go down or your login can be disabled by a DBA. Handling connection failures from the beginning would be a good way to make your application more robust.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In runtime my app gets data from MSSQL server and there's an object that
Working with Microsoft SQL Server I found extremely useful SQL Server Profiler and Estimated
I'm working with a SQL Server 2000 database that likely has a few dozen
I am working on a Customer Server Control that extends another control. There is
I'm working on a database in SQL Server 2000 that uses a GUID for
I'm working on a C# application that queries a SQL Server 2008 Express instance
*Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be
I'm working on a client/server application where the connections from the client to the
Added: Working with SQL Server 2000 and 2005, so has to work on both.
I'm working with SQL Server 2005 and Windows Server 2000 and wonder if there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.