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

  • SEARCH
  • Home
  • 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 8333067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:53:46+00:00 2026-06-09T02:53:46+00:00

I have a customer provided database which is configured with multiple users. Each user

  • 0

I have a customer provided database which is configured with multiple users. Each user has their own username/password etc, which are database logins for SQL Server.

In legacy software, the user is asked for their database and password which is then used to form a connectionstring in code.

I am tasked with replacing a lot of the database code for this, and I need a way of checking a username and password against the database quite quickly. At present, using Linq, if the password is incorrect I eventually get a System.Data.SqlClient.SqlException but this takes quite a while to actually throw (I assume a timeout?).

Does anybody know a good way that I can test my username/password combo against the database quickly?

  • 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-06-09T02:53:48+00:00Added an answer on June 9, 2026 at 2:53 am

    You could try opening a connection through ADO, with a reduced timeout

     SqlConnection conn = new SqlConnection (yourconnectionstring + ";Connection Timeout=1;");          
     try
     { 
         conn.Open();
         conn.Close();
     }
     catch (SqlException ex)
     {
         if (ex.Number == 18456)
         {
              // invalid login
         }
     }
    

    18456 is SQL Invalid login

    The default connection timeout is 15 seconds.

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

Sidebar

Related Questions

I have a php page which has multiple form tags. each form is dealing
I have a Customer class which has a representative field....this field is initially blank
We have an architecture where we provide each customer Business Intelligence-like services for their
I have a project in which I have a database model class provided along
I have an customer invoice table in my MySQL database with a DECIMAL(10,2) field
I have a Customer class that contains a property, MyProperty, which is of a
I have a customer who is currently using Excel to do their staff planning.
We have a customer that would like to modify application user messages that we
I'm working on a web-based business application where each customer will need to have
We have a local server with an access database which feeds data to clients

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.