Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 music
- {
- public partial class Form1 : Form
- {
- SqlDataAdapter da = new SqlDataAdapter();
- DataSet ds = new DataSet();
- SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\sazdb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
- SqlCommand cm = new SqlCommand();
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- con.Open();
- da = new SqlDataAdapter("select * from addmin ", con);
- ds.Reset();
- da.Fill(ds, "addmin");
- da.SelectCommand = cm;
- if (textBox3.Text == Convert.ToString(ds.Tables["addmin"].Rows[0][0]) &&
- textBox4.Text == Convert.ToString(ds.Tables["addmin"].Rows[0][1]))
- {
- Form objform1 = new main();
- objform1.Show();
- }
- else
- {
- if (textBox3.Text != Convert.ToString(ds.Tables["addmin"].Rows[0][0]))
- MessageBox.Show("نام کاربری اشتباه است ");
- if (textBox4.Text != Convert.ToString(ds.Tables["addmin"].Rows[0][1]))
- MessageBox.Show("کلمه عبور اشتباه است");
- }
- con.Close();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- con.Open();
- da = new SqlDataAdapter("select * from honarjoo where code='" + textBox2.Text + "'", con);
- ds.Reset();
- da.Fill(ds, "honarjoo");
- da.SelectCommand = cm;
- if (textBox2.Text == Convert.ToString(ds.Tables["honarjoo"].Rows[0][4]))
- {
- Form objform1 = new honarjoo();
- objform1.Show();
- }
- else
- {
- if (textBox2.Text != Convert.ToString(ds.Tables["honarjoo"].Rows[0][4]))
- MessageBox.Show("رمز اشتباه است ");
- }
- con.Close();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("آیا قصد خروج از برنامه را دارید؟", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
- this.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement