1. 1-rasm Kirish oynasi using System



Yüklə 138,89 Kb.
tarix12.10.2023
ölçüsü138,89 Kb.
#154376
Islom



1.1-rasm Kirish oynasi
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Oquv


{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)


{

}


private void label2_Click(object sender, EventArgs e)
{

}


private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == string.Empty)
{
MessageBox.Show("Username Empty");
}
else if (textBox2.Text == string.Empty)
{
MessageBox.Show("Password Empty");
}
else
{

try
{


SqlConnection g = new SqlConnection(@"server=Hacker\SQLEXPRES;database=log;Integrated Security =true");
SqlCommand h = new SqlCommand("SELECT * FROM tb_log WHERE username=@user and pw=@pw ", g);
g.Open();
h.Parameters.AddWithValue("@user", textBox1.Text);
h.Parameters.AddWithValue("@pw", textBox2.Text);
SqlDataReader dr = h.ExecuteReader();
if (dr.HasRows)
{
this.Hide();
Form1 t = new Form1();
t.ShowDialog();

}
else


{
MessageBox.Show("Check username or password again!!!");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}


1.2-rasm malumotlar oynasi



1.3-rasm tanlash oynasi



1.4-rasm Ma’lumotlarni kiritish oynasi

1.5-rasm Ma’lumotlarni qidirish oynasi

using System;


using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Oquv


{
public partial class Form1 : Form
{
SqlConnection g = new SqlConnection(@"server=Hacker\SQLEXPRES;database=oquv;Integrated Security =true");
public Form1()
{
InitializeComponent();
panel2.Visible = false;
panel4.Visible = false;
panel5.Visible = false;
}

private void label2_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void panel3_Paint(object sender, PaintEventArgs e)


{

}


private void bunifuImageButton1_Click(object sender, EventArgs e)
{
if (panel2.Visible==true)
{
panel2.Visible = false;
bunifuTransition1.ShowSync(pictureBox1);

}
else


{
panel2.Visible = true;
bunifuTransition1.ShowSync(pictureBox1);
panel2.Width = 200;
}
}

private void panel2_Paint(object sender, PaintEventArgs e)


{

}


private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}

private void button4_Click(object sender, EventArgs e)


{
oquv();
}
public void oquv()
{
SqlConnection con = new SqlConnection(@"server=Hacker\SQLEXPRES;database=oquv;Integrated Security =true");
con.Open();
SqlDataAdapter r = new SqlDataAdapter("SELECT TOP (1000) [fio],[adress],[tel],[fan_turi],[narxi]FROM[oquv].[dbo].[o_table]", con);
DataTable data = new DataTable();
r.Fill(data);
dataGridView1.DataSource = data;
}

private void button5_Click(object sender, EventArgs e)


{
if (textBox1.Text == string.Empty)
{
MessageBox.Show("FIO Emty");
}
else if (textBox2.Text == string.Empty)
{
MessageBox.Show("ADRESS Emty");
}
else if (textBox3.Text == string.Empty)
{
MessageBox.Show("TEL Emty");
}
else if (comboBox1.Text == string.Empty)
{
MessageBox.Show("FAN TURI Emty");
}

else
{


g.Open();
SqlCommand cmd = g.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into o_table values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + comboBox1.Text + "','" +textBox4.Text + "')";
cmd.ExecuteNonQuery();
oquv();
g.Close();

textBox1.Text = "";


textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
comboBox1.Text = "";
MessageBox.Show("record inserted successfully");
}
}

private void button6_Click(object sender, EventArgs e)


{
if (textBox1.Text == string.Empty)
{
MessageBox.Show("Fio Emty");
}
else
{
g.Open();
SqlCommand cmd = g.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from o_table where fio='" + textBox1.Text + "'";

cmd.ExecuteNonQuery();


oquv();
g.Close();
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
comboBox1.Text = "";
MessageBox.Show("record deleted successfully");
}
}

private void panel4_Paint(object sender, PaintEventArgs e)


{

}


private void textBox4_TextChanged(object sender, EventArgs e)
{

}


private void button1_Click(object sender, EventArgs e)
{
bunifuTransition2.ShowSync(panel4);
panel4.Visible = true;
panel5.Visible = false;
}

private void button2_Click(object sender, EventArgs e)


{
panel4.Visible = false;
bunifuTransition2.ShowSync(panel5);
panel5.Visible = true;
}

private void textBox5_TextChanged(object sender, EventArgs e)


{
if (comboBox2.Text == string.Empty)
{
MessageBox.Show("ComboBox Emty");
}
else
{
if (comboBox2.Text == "FIO")
{
SqlDataAdapter r = new SqlDataAdapter("SELECT TOP (1000) [fio],[adress],[tel],[fan_turi],[narxi]FROM[oquv].[dbo].[o_table] WHERE FIO LIKE'%" + textBox1.Text + "%'", g);
DataTable data = new DataTable();
r.Fill(data);
dataGridView2.DataSource = data;
}
else if (comboBox2.Text == "ADRESS")
{
SqlDataAdapter r = new SqlDataAdapter("SELECT TOP (1000) [fio],[adress],[tel],[fan_turi],[narxi]FROM[oquv].[dbo].[o_table] WHERE ADRESS LIKE'%" + textBox1.Text + "%'", g);
DataTable data = new DataTable();
r.Fill(data);
dataGridView2.DataSource = data;
}
else if (comboBox2.Text == "TEL")
{
SqlDataAdapter r = new SqlDataAdapter("SELECT TOP (1000) [fio],[adress],[tel],[fan_turi],[narxi]FROM[oquv].[dbo].[o_table] WHERE TEL LIKE'%" + textBox1.Text + "%'", g);
DataTable data = new DataTable();
r.Fill(data);
dataGridView2.DataSource = data;
}
else if (comboBox2.Text == "FAN_TURI")
{
SqlDataAdapter r = new SqlDataAdapter("SELECT TOP (1000) [fio],[adress],[tel],[fan_turi],[narxi]FROM[oquv].[dbo].[o_table] WHERE FAN_TURI LIKE'%" + textBox1.Text + "%'", g);
DataTable data = new DataTable();
r.Fill(data);
dataGridView2.DataSource = data;
}
else if (comboBox2.Text == "NARXI")
{
SqlDataAdapter r = new SqlDataAdapter("SELECT TOP (1000) [fio],[adress],[tel],[fan_turi],[narxi]FROM[oquv].[dbo].[o_table] WHERE NARXI LIKE'%" + textBox1.Text + "%'", g);
DataTable data = new DataTable();
r.Fill(data);
dataGridView2.DataSource = data;
}
}
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
if (comboBox1.Text == "Matematika")
{
textBox4.Text = "250000";
}
else if (comboBox1.Text == "Fizika")
{
textBox4.Text = "250000";
}
else if (comboBox1.Text == "Russian")
{
textBox4.Text = "200000";
}
else if (comboBox1.Text == "English")
{
textBox4.Text = "300000";
}
}
}
}



1.5-rasm Sql Oquv bazasi

1.5-rasm Sql Oquv tablitsasi
Yüklə 138,89 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin