Home > DeveloperSection > Blogs > Login_Form

Login_Form


ASP.Net ASP.Net 
Ratings:
5 Comment(s)
 2722  View(s)
Rate this:


Login_Form    



try
            {
                SqlConnection con = new SqlConnection();
                con.ConnectionString = "Data Source=ARUSHRAJ-PC;Initial Catalog=sample;User ID=sa;Password=niit";
                con.Open();
                SqlCommand cmd = new SqlCommand("Select * From Login_Details Where UserType=@ut AND UserName=@nm AND Password = @ps", con);
                cmd.Parameters.Add("@ut", SqlDbType.VarChar, 50);
                cmd.Parameters.Add("@nm", SqlDbType.VarChar, 50);
                cmd.Parameters.Add("@ps", SqlDbType.VarChar, 50);

                cmd.Parameters["@ut"].Value = comboBox1.Text;
                cmd.Parameters["@nm"].Value = textBox1.Text;
                cmd.Parameters["@ps"].Value = textBox2.Text;

                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    DialogResult rd = MessageBox.Show("Login Succesfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (rd == DialogResult.OK)
                    {

                        if (dr.Read())
                        {
                            label6.Text = dr[1].ToString();
                            label8.Text = dr[0].ToString();
                        }
                    }
                }
                else
                {
                    ctr = ctr + 1;
                    if (ctr < 3)
                    {
                        DialogResult dr1 = MessageBox.Show("You have enter wrong Username or Password. If you are forget your Password or UserName ", "Warning", MessageBoxButtons.RetryCancel,MessageBoxIcon.Warning);
                        if (dr1 == DialogResult.Cancel)
                        {
                            Application.Exit();
                        }
                        linkLabel6.Show();
                        textBox1.Text = "";
                        textBox2.Text = "";
                        textBox1.Focus();
                    }
                    else
                    {
                        MessageBox.Show("You can not access this appliction.Because of you enter 3 times wrong Username or Password", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        textBox1.Text = "";
                        textBox2.Text = "";
                        Application.Exit();
                    }
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

Login Form

By James Smith on   6 months ago
Hi Arushraj,
Please remember few points while writing blog, so that user are able to read and understand it properly. Here I am giving you few tips.
1) Give an introduction about your blogs such as what is purpose of it and how can you perform some task.
2) Explain some terms related with your blogs.
Here I am providing you few links of blog so that you can have an idea about writing.


https://www.mindstick.com/blog/181/lambda-expression-in-c-sharp

https://www.mindstick.com/blog/186/sending-mail-in-asp-dot-net

https://www.mindstick.com/blog/189/creating-dll-in-c-sharp


Thanks.

Login Form

By Haider M Rizvi on   5 years ago
Hi Arush,

First of all I'd like to appreciate you for writing this blog and spreading your knowledge, but this is not the right format of writing blog. If you really want to share your knowledge then do it in a proper manner.

From your current blog no one will understand anything. Try to explain your blog and if you have used any code then try to explain the code as much as possible. For example check out other Blogs on this site.

Keep writing and try to improve your blog quality.

Thanks.

Hello sir.

By Arush Raj on   5 years ago
Sir,
This is my 1st post on this page. I'll try to implement my post things which I'll post in further. I am looking for new ideas for my project. And I visit this page,Its really impress me.
Thanks to appreciate me 4 this. I am such feel good for this,aftr knowing ur comment.

Thanks...

Login Form

By Uttam Misra on   5 years ago
Keep writing.
Good Luck!

Hello sir.

By Arush Raj on   5 years ago
Thanx Mr. Uttam Misra.

Don't want to miss updates? Please click the below button!

Follow MindStick