Create Login Window in C# Using Sql Server


Create login window in c# using SQL Server.
Video shows step by step tutorial for beginners on how to make a login screen with authentication of the user with username and password in windows form application. The application uses SQL Server database to store user details.

Tools Used
* visual studio 2010
* SQL Server 2008

📖 Best C# Book from Amazon (Affiliate)

Download sample project from GitHub

☕ Buy me a Coffee (Channel Support through Donation)

Subscribe to this channel Link to this video
➤ ➤

________________ 🌀 Related Videos __________________
: CRUD Operations in WinForm.
: WinForm Export DataSet/ DataTable.
: Export PDF using iTextSharp.

________________ 🌟 About this Channel ______________
CodAffection – [ New videos every Monday at 12:30 PM UTC. ].
This channel is all about teaching and motivating software developers to build applications/ websites in various technologies/ programming languages like Angular, NodeJS, Asp.Net, C#, JavaScript, SQL, Python, etc.

________________ 🔗 Social Media Links ______________
Blog :
Facebook :
Twitter :
Youtube :

________________ 📚 Most Recommended Books _______
Code Complete(2nd Edition) :
The Art of Computer Programming :
Clean Code :
Design Patterns :
The Pragmatic Programmer :

________________ 💰 Purchase for Developers _________
💻 Laptops
MacBook Air :
Dell XPS 9570 :
ASUS ZenBook 13 :
Lenovo Ideapad :
⌨️ Keyboard : Das 4 Professional :
🖱️ Mouse : VicTsing :
🎧 Headphone : Mpow 059 Bluetooth :

________________ 🎬 All Playlist _______________________
: Angular
: Asp.Net Core
: Node JS
: Asp.Net MVC
: Web API
: MEAN Stack
: C# Tutorial
: Asp.Net WebForm
: C# WinForm
: Crystal Report
: Common C# Excercises
: CG Exercises in C Program

#WinFormCSharpTutorial #CodAffection #CSharpTutorial



  1. : Subscribe to CodAffection : C# CRUD Operations With DB : C# User Registration With DB : Export PDF in C#

  2. Iam using vs 2017 but when i ctrl + s to name the table it doesnt open any dialog box and takes me to save it and not showing it in tables ?
    Can you help me out

  3. Can anyone tell me what we are supposed to press @8.32 ? If I press ctrl + s then It saves file as a sql. Please let me know.

  4. Thank you for good subject guven for me….i have an doubt I. E., u r creating one table that is login table in database right, in that table first username value is 1 only….y u giving user1 as in username value in login form? 1 and user1 both r same in this situation? Please clarify my doubt as soon as possible. I'm waiting for ur response. Tq

  5. Those having issue with sda.Fill(dt);

    please, check your sda query, the username and password we are using from input in the query should have apostrophes " ' " enclosing them. please, check the code carefully and make sure you add those, and your problem will be solved.

  6. Good day maam/sir can i ask for a help 😭😭 im doing right now a kiosks project and i dont know how to pass a value from exe to another exe 😭😭😭

  7. when i try to save the table it comes up a menu asking me where i want to save it to, and doesn't apper in the tables collum after, any help???

  8. Getting this error Plzz Help???

    Error 1 The type or namespace name 'frmMain' could not be found (are you missing a using directive or an assembly reference?

  9. At 8:40 when i press ctl+s instead of showing a dialoge box that shows in the video like choose name,
     my PC asks to saves the file in my documents or in local disk drive instead of saving it in visual studio like a dialoge box has appeared for the name of the table. Please can someone help. Please.

  10. God, don’t do this at your job; you will be fired for it.
    Possibly beating and pushed down an elevator shaft.

    This is just a ‘lookup form’. No hashing which would have taken 30 seconds to add. No lockout policy. No nothing related to a login form.
    This could easily be a search form instead. Well, that is all it is.

    Hash the password. Sha256 or better, at least. Then the database at least requires effort to guess the password. Also, count bad login attempts, a column in the database. Also track the last login date and time, and the last login attempt date and time. Just as easily you could track the IP address or the computer name or some metrics of who is trying to login in order to track down a hacker. Obviously frameworks exist for all of these interfaces like Windows forms or Mvc website or a web forms website. Frameworks also exist for PHP and other shit.

    But seriously just adding a couple fields and at least cashing it would make it a legitimate login for me. All this is doing right now is this matching to text Fields in the database as a search

  11. i am new to c# so can someone say me what i must put in this string query = "Select * from tbl_Login Where username = '" + txtUsername.Text.Trim() + "' and password = '" + txtPassword.Text.Trim() + "'";


Please enter your comment!
Please enter your name here