Биноларни қуришга кетадиган материалларни жамлашда маълумотлар базасидан фойдаланиш.
Листинг коди:
Dastur C+ + Borland Builder muhitida ishlab chiqilgan. Dastur tuzishda quyidagi dasturiy kodlardan foydalanilgan.
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 Qurilish _materallari
{
public partial class Qidirish : Form
{
SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=Davlat;Integrated Security=True");
public Qidirish()
{
InitializeComponent();
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (checkBox1.Checked) {
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where ism like'" + textBox1.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where familiya like'" + textBox2.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
if (checkBox3.Checked)
{
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where manzil like'" + textBox3.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
if (checkBox4.Checked)
{
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where guruh like'" + textBox4.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
if (checkBox5.Checked)
{
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where baho like'" + textBox5.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
if (checkBox6.Checked)
{
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where baho like'" + textBox6.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void textBox7_TextChanged(object sender, EventArgs e)
{
if (checkBox7.Checked)
{
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where oqituvchi like'" + textBox7.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void textBox8_TextChanged(object sender, EventArgs e)
{
if (checkBox8.Checked)
{
SqlDataAdapter da = new SqlDataAdapter("select *from m_oquvchisi where tug_yili like'" + textBox8.Text + "%'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
Do'stlaringiz bilan baham: |