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 7889785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:11:13+00:00 2026-06-03T06:11:13+00:00

Am building window form application using VS2010.On my login form i collect useid and

  • 0

Am building window form application using VS2010.On my login form i collect useid
and password and then click on the login button, if validation is successful direct
users to the main form.
I want to use a Dictionary to store userid and password read from the DB.
Then close connection. i then compare the inputed values from the textbox againt values:
userd and passward in the dictionary. on sucess direct to main form
here is my code. pls help`

string connectionstring =
   "Data Source =localhost;Initial Catalog=HSM;" +
   "User Id=sysad;Password=mypassword";

   SqlConnection connection = new SqlConnection(connectionstring);
   SqlCommand selectcmd = new SqlCommand("Select * from users");
   SqlDataReader reader ;
   Dictionary<string,string> logintest = new Dictionary<string,string>
   try
   {
      connection.Open();
      reader = selectcmd.ExecuteReader();
      while (reader.Read())
      {                
         Mainform main1 = new Mainform();
         this.Hide();
         main1.Show();
      }

      reader.Close();
       `  
  • 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-03T06:11:15+00:00Added an answer on June 3, 2026 at 6:11 am

    Simple

    foreach (KeyValuePair<string, int> pair in logintest)
    {
      Console.WriteLine("{0}, {1}", pair.Key, pair.Value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am building windows form application for a Hospital using VS2010 ON ACCESS 2010. I
I am building a Windows form application using .NET 3.5. I would like to
Hey so I'm building an iOS app. The fist window is a login screen
I 'am building a small windows form application. I have a View - a
I'm working with a new application at work that we're building out using Knockout.js
I am building a small windows form application in C#. Within the form code
I am building a chat application using JSP, Servlets and Ajax with Smack API.
In my Facebook application I am displaying a message window using FB.ui { method:
I'm building a Windows Form that includes a combo box control, and I wanted
I'm building a Windows Forms form in C# with various elements in a panel

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.