Quantum Internet Benefits

Image
  The quantum internet is a network of quantum computers that are connected together using quantum communication. It has the potential to revolutionize many industries, including: Secure communications: The quantum internet would be inherently secure, as it would be impossible to eavesdrop on quantum communications without being detected. This could be used for applications such as secure financial transactions, government communications, and military applications. Quantum computing: The quantum internet would allow quantum computers to be connected together, which would allow them to solve problems that are currently impossible for classical computers. This could be used for applications such as drug discovery, financial modeling, artificial intelligence, and materials science. Quantum sensors: The quantum internet could be used to connect quantum sensors together, which would allow them to create a global network of sensors that could be used to monitor the environment, detect earthq

Login and Registration forms in C# windows application with Back end Microsoft SQL Server for data access


In this article, I'm gonna share about how to make login and register form with MS SQL database;

1. Flow Chart Logic





















2. Normal Features




3. Form Designs
Login Form Design


Sign in Form Design



Password Retrieve Form



4. Database Design and SQL queries and Stored Procedure

Create new Database as "schooldata"
create table registerdata
(
 ID int identity,
 Username nvarchar(100),
 Password nvarchar(100),
 Fullname  nvarchar(100),
 MobileNO nvarchar(100),
 EmailID nvarchar(100) 
)

select * from registerdata

create procedure regis
(
 @Username as nvarchar(100),
 @Password as nvarchar(100),
 @Fullname as nvarchar(100),
 @MobileNO as nvarchar(100),
 @EmailID as nvarchar(100) 
)
as begin
insert into registerdata (Username, Password, Fullname, MobileNO,EmailID)
values (@Username, @Password, @Fullname, @MobileNO, @EmailID)
end


5. App.config Settings

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <configSections>
  </configSections>
  <connectionStrings>
    <add name="ConnData"
        connectionString="Data Source=localhost\sqlexpress;Initial Catalog=Schooldata;Integrated Security=True"
        providerName="System.Data.SqlClient" />
  </connectionStrings>
  
</configuration>


6. SignIn Form Coding

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using System.Net;
using System.Collections.Specialized;

namespace SchoolData
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SigninForm sf = new SigninForm();
            sf.Show();
            this.Hide();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if ((textBox1.Text != "") && (textBox2.Text != ""))
            {
                string constring = ConfigurationManager.ConnectionStrings["ConnData"].ConnectionString;
                SqlConnection con = new SqlConnection(constring);
                string q = "select * from registerdata where Username = @Username and Password = @Password ";
                SqlCommand cmd = new SqlCommand(q, con);
                cmd.Parameters.AddWithValue("@Username", this.textBox1.Text);
                cmd.Parameters.AddWithValue("@Password", this.textBox2.Text);
                con.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    if (dr.HasRows == true)
                    {
                        MessageBox.Show("Login Successfully Done");
                    }
                }
                if (dr.HasRows == false)
                { MessageBox.Show("Access Denied, password username mismatched"); }
            }
            else { MessageBox.Show("Enter username and password"); }
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            RetrievePwdForm rf = new RetrievePwdForm();
            rf.Show();
            this.Hide();
        }
        
    }
}


7. Register Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using System.Net;
using System.Collections.Specialized;

namespace SchoolData
{
    public partial class SigninForm : Form
    {
        public SigninForm()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }
        //checking whether username already exist
        public void UserNameCheck()
        {
            string constring = ConfigurationManager.ConnectionStrings["ConnData"].ConnectionString;
            SqlConnection con = new SqlConnection(constring);
            SqlCommand cmd = new SqlCommand("Select * from registerdata where Username= @Username", con);
            cmd.Parameters.AddWithValue("@Username", this.textBox1.Text);
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                if (dr.HasRows == true)
                {
                    MessageBox.Show("Username = "+ dr[1].ToString() +" Already exist");
                    break;
                }
            }
            //return textBox1.Text  ;
        }
        // clear all values in textbox
        public void clearall()
        {
            textBox1.Text = " ";
            textBox2.Text = " ";
            textBox3.Text = " ";
            textBox4.Text = " ";
            textBox5.Text = " ";

        }
        //checking whether mobile number already exist
        public void MobileNOCheck()
        {
            string constring = ConfigurationManager.ConnectionStrings["ConnData"].ConnectionString;
            SqlConnection con = new SqlConnection(constring);
            SqlCommand cmd = new SqlCommand("Select * from registerdata where MobileNO= @MobileNO", con);
            cmd.Parameters.AddWithValue("@MobileNO", this.textBox4.Text);
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                if (dr.HasRows == true)
                {
                    MessageBox.Show("MobileNO = " + dr[4].ToString() + "is Already exist");
                    break;
                }
            }
            //return textBox4.Text;
        }
        public void datastore()
        {

            string Fname, Sname, Fullname, MobileNO, EmailID;
            Fname = textBox1.Text;
            Sname = textBox2.Text;
            Fullname = textBox3.Text;
            MobileNO = textBox4.Text;
            EmailID = textBox5.Text;
            try
            {
                string constring = ConfigurationManager.ConnectionStrings["ConnData"].ConnectionString;

                /* Declaring Connection Variable */
                SqlConnection con = new SqlConnection(constring);

                /* Checking Connection is Opend or not If its not open the Opens */
                if (con.State != ConnectionState.Open)
                    con.Open();

                /* Calling Stored Procedure as SqlCommand */
                SqlCommand cmd = new SqlCommand("regis", con);
                cmd.CommandType = CommandType.StoredProcedure;

                /* Passing Input Parameters with Command */
                cmd.Parameters.AddWithValue("@Username", Fname);
                cmd.Parameters["@Username"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@Password", Sname);
                cmd.Parameters["@Password"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@Fullname", Fullname);
                cmd.Parameters["@Fullname"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@MobileNO", MobileNO);
                cmd.Parameters["@MobileNO"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@EmailID", EmailID);
                cmd.Parameters["@EmailID"].Direction = ParameterDirection.Input;

                /* Executing Stored Procedure */
                cmd.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Data Inserted Succesfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
             
        }
        public void registerdata()
        {       datastore();
                this.Hide();
                LoginForm lf = new LoginForm();
                lf.Show();
            
        }
        private void button1_Click(object sender, EventArgs e)
        {
            registerdata();
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            //UserNameCheck();
            //clearall();
        }

        private void textBox4_KeyDown(object sender, KeyEventArgs e)
        {
            //MobileNOCheck();
            //clearall();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            //UserNameCheck();
            //clearall();
        }

        private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
        {
            //MobileNOCheck();
            //clearall();
        }

        private void textBox4_KeyUp(object sender, KeyEventArgs e)
        {
            //MobileNOCheck();
            //clearall();
        }
        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            //UserNameCheck();
            //clearall();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            UserNameCheck();
           
        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {
           // MobileNOCheck();
           
        }

        private void textBox4_TextChanged_1(object sender, EventArgs e)
        {
            MobileNOCheck();
        }
    }
}

8. Retrieve Password Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using System.Net;
using System.Collections.Specialized;

namespace SchoolData
{
    public partial class RetrievePwdForm : Form
    {
        public RetrievePwdForm()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            LoginForm lf = new LoginForm();
            lf.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string constring = ConfigurationManager.ConnectionStrings["ConnData"].ConnectionString;
            SqlConnection con = new SqlConnection(constring);
            SqlCommand cmd = new SqlCommand("Select * from registerdata where MobileNO= @MobileNO", con);
            cmd.Parameters.AddWithValue("@MobileNO", this.textBox1.Text);
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                if (dr.HasRows == true)
                {
                    string str = "Your Password = ";
                    label2.Text=str +  dr[2].ToString();
                }
            }
        }
    }
}

Output


a) Register New User and store into database






b) Check Username already Exist

C) Check Mobile Number Already Exist


D) Forget Password



Finally Login Successfully done



















Comments

  1. shows error in the name 'ConfigurationManager' does not exist in the current context

    ReplyDelete
  2. Thank you very much! (^_^)
    It's so useful for me to learn. Thanks :)

    ReplyDelete
  3. If I continue to click Register Button in SinginForm even though it announces error:"Both Username and MobileNO are already exist!",
    it's still save datas into database and it is "Polymeric Datas about Username and MobileNO". Do you have solutions to resolve it? Please, help me!

    ReplyDelete
  4. Thank you very much! (^_^)
    It's so useful for me to learn. Thanks :)

    ReplyDelete
  5. is this necessary to add configuration in app config?

    ReplyDelete
  6. can you please upload complete project ???

    ReplyDelete
  7. How to make the values @Username , @Password ?

    ReplyDelete
  8. when I register then showing
    configuration system failed to initialize

    ReplyDelete
  9. Great info provided, thanks for the help. cpDESK is Online Web Development Tool Company located in Canada.For more details please visit our site - Web Application Development Tool Company | cpDESK

    ReplyDelete
  10. hey Sir, Would u like to send me the full source code with database on manwendrapratapsingh@gmail.com

    ReplyDelete
  11. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Devops Training courses
    python Training in chennai
    Devops Training in Bangalore

    ReplyDelete

  12. Really nice topics you had discussed above. I am much impressed. Thank you for providing this nice information here.
    Hire Windows Application Developer

    ReplyDelete
  13. HOW CAN I DOWNLOAD THAT PROJECT? MAY YOU ASSIST

    ReplyDelete
  14. I have truthfully never come across such overwhelmingly good piece of content. I agree with your valid points and your ideas. This piece of information is really great.
    Thank you so much.
    SAP training in Kolkata
    SAP course in kolkata

    ReplyDelete
  15. It is extremely nice to see the greatest details presented in an easy and understanding manner. ExcelR Data Analyst Course

    ReplyDelete
  16. Thanks for the Valuable information.Really useful information. Thank you so much for sharing. It will help everyone.

    Tableau Training in Delhi.


    FOR MORE INFO:

    ReplyDelete
  17. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site. And Stock market is a place where many new stock market traders join the share trading league daily and trade daily in Share Tips, Intraday traders, Stock Market investors and market beginners should understand the meaning of the stock market for beginners cutting the learning curve.

    ReplyDelete
  18. Interesting and Amazing blog, Thanks for this useful knowledge-sharing blog.
    Henna Powder Hair Colors

    ReplyDelete
  19. Thank you for sharing such a nice blog. I really enjoy while reading it to know deeply

    You can put your thought here at articlesvibe.site

    ReplyDelete
  20. Hello, thank you for the information. I have been able to obtain new information here. However, I use this page to specialize in some technical problems. I have reloaded the page many times, so I was able to load it correctly. I wonder if your web host was OK.정읍출장샵
    남원출장샵
    군산출장샵
    전주출장샵
    김제출장샵
    김해출장샵
    밀양출장샵

    ReplyDelete

  21. very nice website with good content.will sure visit again. Thanks
    https://rankingtop.in/
    https://techhitech.in/
    https://matrixmanpowersolutions.xyz/
    https://advertise.techhitech.in/
    https://speedzpackersmovers.in/
    https://topranker.xyz/
    https://rapidshift.co.in/
    https://rapidshiftpackers.com/

    ReplyDelete
  22. nicely explained article. thanks for sharing
    https://vmsdcc.co.in/

    ReplyDelete

Post a Comment

Share this to your friends

Popular posts from this blog

Jsp / Java Password Encrypt and Decrypt Example

SQL Script : Adventure works database setup and Select query, list of tables #100daysofsql

How to Hide Gridview and Show the selected gridview row details in Form View using ASP.NET C#