- 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;
- using System.Threading;
- namespace dataentry
- {
- public partial class Login : Form
- {
- public Login()
- {
- InitializeComponent();
- }
- SqlConnection connection = new SqlConnection("Data Source=.;Initial Catalog=dataentry;Integrated Security=True;Pooling=False");
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void button11_Click(object sender, EventArgs e)
- {
- for (int beepcount = 0; beepcount <= 3; beepcount++)
- {
- Console.Beep();
- Thread.Sleep(1000);
- }
- SqlDataAdapter adapter = new SqlDataAdapter("select count(*) from LOGINWINDOW where USERNAME='" + username.Text + "' and PASS='" + password.Text + "'", connection);
- DataTable dt = new DataTable();
- adapter.Fill(dt);
- if (dt.Rows[0][0].ToString() == "1")
- {
- this.Hide();
- //Form1 f1 = new Form1();
- //f1.Show();
- }
- else
- {
- MessageBox.Show("incurect user name and password !!!");
- }
- }
- }
- }
Facebook Comment