26 thg 6, 2019

WINDOWS FORMS: CREATE METRO LOGIN FORM WITH SQL DATABASE IN C#

This post shows you How to Create a Metro Login Form with SQL Database using Metro Framework, Dapper ORM in C# .NET Windows Forms Application.

The login form is a must-have feature in any software management. It helps users protect their data or authorize used functions corresponding to the permissions. To practice demo you should create a new windows forms project as the following.
To play the demo, you should create a new windows forms project. Next, right click on your project, then select Manage NuGet Packages -> Search metro framework, dapper -> Install it on your project.
If you don't see the metro framework in your toolbox, you can view How to download and install metro framework
As you know, The Metro Framework is a library that supports multiple control for windows forms and Dapper ORM is a high performance Micro-ORM supporting SQL ServerMySQLSqliteSqlCEFirebird ...etc.
Drag the MetroTextBoxMetroButtonMetroCheckBox and Panel controls, then design a simple metro login form as shown below.
metro login form
Create the User class allows you to map your data return from user table in sql server.
1
2
3
4
5
public class User
{
    public string UserName { getset; }
    public string Password { getset; }
}
You can copy the sql script below to create a new database.
1
2
3
4
5
6
7
8
USE [master]
GO
CREATE DATABASE [dbuser]
 CONTAINMENT = NONE
 ON  PRIMARY
NAME = N'dbuser', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\dbuser.mdf' SIZE = 4096KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON
NAME = N'dbuser_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\dbuser_log.ldf' SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
Next, Run the script below to create the User table
video

tham khảo tại đây.

WINDOWS FORMS: CREATE METRO LOGIN FORM WITH SQL DATABASE IN C# Rating: 4.5 Diposkan Oleh: http://pdunoteit.blogspot.com/