Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Звіт.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
497.56 Кб
Скачать

Код програми

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 MySql.Data.MySqlClient;

namespace WindowsFormsApplication1

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

combo();

}

void combo()

{

string myConnection = "datasource=localhost;port=3306;username=root;password=";

string Query = "SELECT * FROM res.custom ;";

MySqlConnection conDatabase = new MySqlConnection(myConnection);

MySqlCommand cmdDataBase = new MySqlCommand(Query, conDatabase);

MySqlDataReader myReader;

try

{

26

conDatabase.Open();

myReader = cmdDataBase.ExecuteReader();

while (myReader.Read())

{

string sname = myReader.GetString("strava");

comboBox2.Items.Add(sname);

}

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

}

private void label1_Click(object sender, EventArgs e)

{

}

private void label2_Click(object sender, EventArgs e)

{

}

private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)

{

}

private label4_Click(object sender, EventArgs e)

{

}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)

{}

private void comboBox2_ChangeUICues(object sender, UICuesEventArgs e)

27

{

}

private void button1_Click(object sender, EventArgs e)

{

tabControl1.SelectedTab = tabPage2;

}

private void button3_Click(object sender, EventArgs e)

{

richTextBox3.Clear();

}

private void button2_Click(object sender, EventArgs e)

{

tabControl1.SelectedTab = tabPage1;

richTextBox1.Clear();

richTextBox2.Clear();

}

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)

{

string myConnection = "datasource=localhost;port=3306;username=root;password=";

string Query = "SELECT * FROM res.custom where strava = '" + comboBox2.Text + "' ;";

MySqlConnection conDatabase = new MySqlConnection(myConnection);

MySqlCommand cmdDataBase = new MySqlCommand(Query, conDatabase);

MySqlDataReader myReader;

try

{

conDatabase.Open();

myReader = cmdDataBase.ExecuteReader();

while (myReader.Read())

28

{

string sname = myReader.GetString("strava");

string scina = myReader.GetInt32("cina").ToString();

string sinhrediyenty = myReader.GetString("inhrediyenty");

richTextBox1.Text = sinhrediyenty;

richTextBox2.Text = scina;

}

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

}

}

}

29

30

Джерела інформації

http://pidruchniki.com/1151022547728/informatika/inzheneriya_vimog

http://ua-referat.com/

http://uk.wikipedia.org/wiki/

http://it-ua.info/news/2014/05/06/nefunkconaln-vimogi.html

31

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]