This is a C# Practice code:
- 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.SqlClient;
- namespace dataentry
- {
- public partial class PASSWORDChange : Form
- {
- public PASSWORDChange()
- {
- InitializeComponent();
- }
- private void button11_Click(object sender, EventArgs e)
- {
- this.Hide();
- // Form1 F1 = new Form1();
- //F1.Show();
- }
- SqlConnection CON = new SqlConnection("Data Source=.;Initial Catalog=dataentry;Integrated Security=True;Pooling=False");
- private void button10_Click(object sender, EventArgs e)
- {
- SqlDataAdapter ASDF = new SqlDataAdapter("SELECT COUNT(*) FROM LOGINWINDOW WHERE USERNAME='"+textBox1.Text+"' AND PASS='"+textBox2.Text+"'",CON);
- DataTable DS = new DataTable();
- ASDF.Fill(DS);
- errorProvider1.Clear();
- if (DS.Rows[0][0].ToString() == "1")
- {
- if (textBox3.Text == textBox4.Text)
- {
- if (textBox3.Text.Length > 6)
- {
- SqlDataAdapter cc = new SqlDataAdapter("update LOGINWINDOW set pass='" + textBox3.Text + "'where username='" + textBox1.Text + "' and pass='" + textBox2.Text + "' ", CON);
- DataTable DF = new DataTable();
- cc.Fill(DF);
- MessageBox.Show("Password Changed..!!", "message", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- errorProvider1.SetError(textBox3,"SET MINIMUN 6 CHARECTOR...!!");
- }
- }
- else
- {
- errorProvider1.SetError(textBox3,"UnMatch Password");
- errorProvider1.SetError(textBox4, "UnMatch Password");
- }
- }
- else
- {
- errorProvider1.SetError(textBox1,"incorrect user name");
- errorProvider1.SetError(textBox2, "incorrect password");
- }
- }
- }
- }
Facebook Comment