close

Вход

Забыли?

вход по аккаунту

?

Moe PZ

код для вставкиСкачать
??????????? ????????? ??????????? ? ?????
?????? ??????????????? ??????????? ???????????
??????? "?????????????????? ??????? ????????? ?????????? ? ??????????"
????????????? ??????? ? ????????? ???????
?? ?????????? "????"
?????????? ??? ?????? ? ??
??????? 7
????????????,
??????, ?.?.?. ?.?. ??????
???????, ????
???????????:
????????? ??. ???-449 ?.?. ???????????
???????, ????
???? 2012
???????
????????????? ??????? 28 ?., 1 ?., 8 ???., 1 ????., 3 ?????????.
MICROSOFT SQL SERVER, ??????, ????, C#, ???? ??????
???????? ???????????? ??????? ????????? ??????? ???????? ???? Microsoft SQL Server ? ?? ??????????? ?????????????? ?? ?????????? ????????????.
???? ???????? ?????? - ?????????? ?????????? ?? ????? ???????? ??????, ?????????????????? ? ????? ?????? ??? ??????????? MS SQL Server.
? ???????? ?????? ?????????? ????? ? ?????? ???????????? ??? C# ?? ?????????????? ? MS SQL Server. ????? ?? ???? ????? ???????? ?????? ???? ??????? ??????????, ????????? ????????????, ????????????? ? ???????? ?????? ? ???? ?????? ??? ??????????? MS SQL Server. ? ???????? ???? ?????? ??? ?????????? ???? ??????? ????, ????????? ? ???? ????????????? ?????????? (?????????? ??????? "???????????? ???????").
? ?????????? ?????? ??????? ?????????? ?? ??? C#, ?????????? ???????????? ???????????.
??????????
????????5
1 ???????? ????????????? ???? ??????6
1.1 ?????????? ???????6
1.2 ?????????????? ???? ??????6
1.3 ??????????? ?????????? ? MS SQL7
2 ?????????? ??????????8
2.1 ?????? ? ?????? ??????? ??????8
2.2 ?????????? ?????????9
2.3 ?????????? ????????????????? ??????????10
2.4 ????????? ????11
2.5 ???????????? ? ??????? ??????????13
3 ??????????? ????????????14
3.1 ??????????? ????????????14
3.2 ??????????? ?????????? ??????????????18
??????????20
?????? ?????????????? ??????????21
?????????? ?. ??? ?????????22
????????
??????? ?????????? ?????? ?????? (????) - ??????????? ???????????, ?????????????? ??????????? ? ????????? ??? ??????. ??????????? ???? ???????? MS SQL Server, Oracle Database, MySQL. ? ???? ???????????? ??????? ????????? ?????? ??? ??????????? ?????????, ?????? ?? ??????? ? ????? ??? ?????? ??? ?????????? ??????????.
Microsoft SQL Server - ??????? ?????????? ???????????? ?????? ?????? (????), ????????????? ??????????? Microsoft. ???????? ???????????? ???? ???????? - Transact-SQL, ?????? ????????? Microsoft ? Sybase. ???????????? ??? ?????? ? ?????? ?????? ???????? ?? ???????????? ?? ??????? ??? ?????? ???????? ???????????.
???? ???????? ?????? C# ????????? ??????????? ??????? ??????????? ??? ?????????????? ? ?????? ?????? MS SQL Server ??? ????????????? ??????????? ????????? ????????? ? ??????????.
?????? ?????? ????????????? ??????? ???????? ???????? ????????? ? ???? ????????????? ?????????? ???? ?????? ?? ???????? ?????????? ???????, ?????? - ??????? ?????????? ??????????, ? ??? ????? ?????? ???????? ? ????? ?????????, ?????????? ????????? ? ???????????? ??????????, ??????????? ? ????????????, ?????? ?????? ???????? ???????????? ? ?????????? ??????????.
1 ???????? ????????????? ???? ??????
1.1 ?????????? ???????
??????? 7. ???????????? ???????.
???????????? ??????? ?????? ???????????? ??????? ???????????? ???????? ?????. ?????? ?????????????, ?. ?. ????????? ?? ?????? ? ????????? ?????? ??????. ??? ????????? ??????? ??? ??????????? ?????? (????????, ??? ????????????, ?????, ???????) ??????????? ? ???? ??????. ?? ??????? ????? ???????? ?????? ??????? ???????????? ????????, ? ??????? ??????????? ????, ??????, ????? ??????, ???????????? (????? ???????), ???????? ??????. ? ?????? ????? ?????? ??????? ????? ???? ??????? ????????? ?????. ????????? ?????? ?????? ???????????. ????? ???? ???????? ????????????? ? ?????? ????? ?????? ????????? ???? ??????. ?????? ????? ????????????? [1].
1.2 ?????????????? ???? ??????
??? ?????????????? ?????????????? ER-??????????, ??????????? ?????????? ? ?????????? ?????? ????????????? ????????? IDEF1X. ???? ?????????? ?????? ????????: "??????", "??????", "??????" ? "??????", ????? ???????? ??????????? ?????????????????? ????? ????????? ????-??-??????. ?????????? ?????? ?????? "???????????? ???????" ? ????????? IDEF1X ???????????? ?? ??????? 1, ? ?????????? - ?? ??????? 2.
??????? 1 - ?????????? ?????? ??????
??????? 2 - ?????????? ?????? ??????
1.3 ??????????? ?????????? ? MS SQL
??? ???????? ???????? ???? ?????? ? MS SQL ????????? ???? ?????? ?????????? ?? ????????? ? ?????????? ?????? ??????, ? ??????:
- ??? VARCHAR2() ??????? ????? NCHAR();
- ??? INTEGER ??????? ????? INT.
2 ?????????? ??????????
2.1 ?????? ? ?????? ??????? ??????
2.1.1 ?????????? ? ??????????
????? ?????????? ???????? ?????? ? ??????? ?? ??? ??????????? MS SQL Server.
???????????? ???????????? ? ???? ?????? "????????". ????? ??????????? ???????????? ??? ??????? ?? ? ???????????? ????????? ?????? ? ???.
2.1.2 ?????????? ? ?????????????? ???????????????
??????????? ??????? ?????? ???????????? ?????????? ????????? ???????:
- ??????????? ??????????? ???? ??????;
- ?????????????? ?????? (???????? ? ??????????);
- ???????? ????????? ?? ??????? ?????;
- ?????? ? ?????????? ?????????? ?? ???????? ???????? ?? ?????????;
- ?????????? ?????????????? ?? ???????;
- ??????????? ???????????? ????????????? ?????????? ????????.
2.1.3 ?????????????? ???????? ??????????????? ???????????? ????????
?????????????? ???????? ??????????????? ???????????? ???????? - ?????????.
2.2 ?????????? ?????????
??? ?????????? ????????? ???????? ????? ????????? ????? ?????? ?? ????? ??????? (????? ???????????? [2]). ???????? ???????? ????????? ?????????? ??????? ????????? ????. ????? ??????? ????????? ???????????? ???? ?? ??????? 3.
??????? 3 - ????? ????????? ?????????
2.3 ?????????? ????????????????? ??????????
????????? ???????????? ??? ?????????? ??? ????????????? ??????????? ????????????????. ????? ??????????? ?????????????? ????????? ? ????????????? ???????? ??????? ? ??????????? ??????????? ???????????? (GUI), ???????????? ? ?????????????? (???? ? "????"). ?????? ???????? ????? ????????? ???? ??????? ?? ??????? 4.
??????? 4 - ?????? ????????? ????
2.4 ????????? ????
?????????? ??????????? ?? ????????-??????????????? ????? ???????? ?????? C# [3] ? ????? ?????????? Microsoft Visual Studio 2010, ???????? ??????. 2.4.1 ????????? ????????
??? ????????? ?????????? ? ?????????????? ????????? ???? ?? ??? ???????????????, ? ????? ??????????????. ?????? ??????? ????????? ???????? ? ?????????? ?.
????????? ??????? ?? ?????????? ????. ?????? ????? ??? ???????? ???? ?????????, ????? ???? ???? "? ?????????", "?? ??????" ? "??????????? ????????????", ??????? ???????? ?????????? ??????????. ??? ???? ??????? ???????? ??????????? ??????????, ???????? ?????? ???? ?????????? ??? ??????? ?? ?????? "??".
2.5 ???????????? ? ??????? ??????????
?????? ?????, ???? ????????? ???????????? ?????????? ?????????????? ???????????????.
?????????? ????????? ??????????? ? ??????? ????????? ???? ?????? ?? MS SQL Server. ????? ?????????? ????????? ????????????? ?????? ??, ? ??? ?????, ???????? ? ??????????, ???????? ?????? ???????? ??????????? ?? ??????? ?????. ? ????????? ???? ?????? ? ?????????? ?????????? ?? ???????? ???????? ? ?????? ?? ?????????. ??? ????????? ?? ??????? ????????? ???????????? ? ????????? ????. ?, ???????, ???????????? ????? ????????????? ?????????? ??? ????????? ????????.
3 ??????????? ????????????
3.1 ??????????? ????????????
3.1.1 ?????????? ?????????
????? ?????????? ???????? ?????? ? ??????? ?? ??? ??????????? MS SQL Server. ????????? ???????? ?? IBM ??????????? ???????????? ???????????.
??? ??????? ?????????? ?????????? ????????????? ??????? .NET Framework 4 ??? ?????, MS SQL Server 2008 ( ????????????? MS SQL Server 2012) ??? ????? ? ??????????? ???????? ? ???????????? ??????? MS Windows XP ? ?????.
3.1.2 ??????? ?????????? ?????????
??????????? ????????????:
- ??? ?????????? Athlon XP ??? Pentium 4 ? ????;
- ????? ???256 ?? ? ??????;
- ??? ????????VGA ? ????;
- ??? ??????????????????????, ????.
3.1.3 ?????????? ?????????
???????????? ????? ????????? ?????????? ? ????? DataBase.exe. ???????????? ????? ?????? ???????? ???? ?????????, ??? ???????????? ?? ??????? 5.
??????? 5 - ???????? ???? ?????????
????? ????? ????????? ??????????? ????????: 1) ??????????? ?????????? ????????????? ????????, ????? ?? ??????????????? ?????? "?????????" ? ?????? ?????? ???? ?????? ? ?????? ??????? "????????? ????????".
?????? ?????????? ?????? ?? ???????? ??????????? ?? ??????? 6.
??????? 6 - ?????????? ???????
2) ??????? ? ???? "????" ????? "???????????? ? ??" ? ?????????? ?? ??? ???????????? ???????. ????? ?????????? ??????? ???????? ???????????? ?????? ??? ??????? ?? ???? ??????, ??? ???????????? ?? ??????? 7.
??????? 7 - ??????????? ? ???? ??????
3) ?????? ????????? ? ??????? (???????? ??? ??????? ??????), ???????????????? ????????? ? ????? ?????? ???? ??????.
?????? ?????????? ????? ?? ?????????? ?????? ? ??????? "??????" ???????????? ?? ??????? 8.
??????? 8 - ?????????? ?????? ? ???????
4) ???????? ?????????? ??????????, ?????? ??????????????? ????? ?? ???? "???????".
3.2 ??????????? ?????????? ??????????????
3.2.1 ?????????? ?????????
????? ?????????? ???????? ?????? ? ??????? ?? ??? ??????????? MS SQL Server. ????????? ???????? ?? IBM ??????????? ???????????? ???????????.
??? ??????? ?????????? ?????????? ????????????? ??????? .NET Framework 4 ??? ?????, MS SQL Server 2008 ( ????????????? MS SQL Server 2012) ??? ????? ? ??????????? ???????? ? ???????????? ??????? MS Windows XP ? ?????.
3.2.1 ??????? ?????????? ?????????
??????????? ????????????:
- ??? ?????????? Athlon XP ??? Pentium 4 ? ????;
- ????? ???256 ?? ? ??????;
- ??? ????????VGA ? ????;
- ??? ??????????????????????, ????.
3.2.1 ????????? ?????????
????????? ??????? ?? ???????????? ????? Database.exe ? ?????? ????? ???? ??????. 3.2.1 ????????? ?????????
??? ????????? ?????????? ?????????? ????????? Notarius.sfx ? ??????????? ????? ? ????????? ????? ?? ??????????. ??? ?????? ?????? ????? ??????? ???? Database.exe ?? ????????????? ??????. ??? ?????? ????????? ??????????, ????? ???? ??????????? .NET Framework v4.0 . ??? ?? ?????? ???? ?????????? MS SQL Server 2008 (????????????? MS SQL Server 2012) ? ????? ? ???????? ??? ??????.
3.2.1 ???????? ?????????
????????? ???????? ?????? ?????? ? ?????? ??????????. ???? ????????? ?? ???????????, ?????? ???? ?? ???? ?????????? ????? Microsoft .NET Framework, ???? ?????????? ????????????? ? ????????.
??????????
? ?????????? ?????????? ?????? ???????? ?????? ??? ??????? ???? ? ??????????????, ???????? ? ?????????? ???? ?????? ? ???????????? ????? C# ??? ?????? ? ??. ??? ?? ???? ??????? ??????????, ??????????? ???????? ? ?????? ?????? ??? ??????????? ???? MS SQL Server, ? ??? ?? ???????? ?????? ? ???. ?????????? ???????? ???? ???????????? ???????????.
?????? ?????????????? ??????????
1 ?????? ? ???? MySQL: ????. ??????? / ?. ?. ??????, ?. ?. ????????????. - ????: ???-?? ?????, 2010. - 84 ?.
2 ????????? ?. ?.. ?????????? ????????????????: ???????????? ???????? ? ????????? ??????????????. - ????: ???-?? ?????, 2005. - 44 ?.
3 ????? ???????. ?????? ?????????? ?? ?#: ???. ? ????. - ?.: ???????????? ??? "???????", 2004. - 752 ?.: ??.
?????????? ?
(????????????)
??? ?????????
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.IO;
namespace DataBase
{
public partial class Form1 : Form
{
//??????? ??????????? ? ???? ?????? SqlConnection connect = new SqlConnection("Server=localhost;" + "database=Notarius;" + "Integrated Security=True");
public Form1()
{
InitializeComponent();
tabPage2.Text = "???????";
tabPage1.Text = "??????";
tabPage3.Text = "??????";
tabPage4.Text = "??????";
tabPage5.Text = "????????? ???????";
tabPage6.Text = "???????";
tabPage7.Text = "??????";
tabPage8.Text = "??????";
tabPage9.Text = "??????";
tabPage10.Text = "???????? ?????? ? ???????";
tabPage11.Text = "??????? ?????? ?? ???????";
}
private void ???????????????ToolStripMenuItem_Click(object sender, EventArgs e)
{ connect.Open();
//??????? ?????? ?? ??????? ??????
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Klient", connect);
DataSet ds = new DataSet();
SqlCommand comm = new SqlCommand("SELECT * FROM Klient", connect);
adapter.SelectCommand = comm;
DataTable table = new DataTable();
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter.Fill(table);
BindingSource bs = new BindingSource();
bs.DataSource = table;
dataGridView1.DataSource = bs;
// ??????? ?????? ?? ??????? ??????
SqlDataAdapter adapter2 = new SqlDataAdapter("SELECT * FROM Sdelka", connect);
DataSet ds2 = new DataSet();
SqlCommand comm2 = new SqlCommand("SELECT * FROM Sdelka", connect);
adapter2.SelectCommand = comm2;
DataTable table2 = new DataTable();
table2.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter2.Fill(table2);
BindingSource bs2 = new BindingSource();
bs2.DataSource = table2;
dataGridView4.DataSource = bs2;
//??????? ?????? ?? ??????? ??????
SqlDataAdapter adapter3 = new SqlDataAdapter("SELECT * FROM Skidka", connect);
DataSet ds3 = new DataSet();
SqlCommand comm3 = new SqlCommand("SELECT * FROM Skidka", connect);
adapter3.SelectCommand = comm3;
DataTable table3 = new DataTable();
table3.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter3.Fill(table3);
BindingSource bs3 = new BindingSource();
bs3.DataSource = table3;
dataGridView2.DataSource = bs3;
//??????? ?????? ?? ??????? ??????
SqlDataAdapter adapter4 = new SqlDataAdapter("SELECT * FROM Usluga", connect);
DataSet ds4 = new DataSet();
SqlCommand comm4 = new SqlCommand("SELECT * FROM Usluga", connect);
adapter4.SelectCommand = comm4;
DataTable table4 = new DataTable();
table4.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter4.Fill(table4);
BindingSource bs4 = new BindingSource();
bs4.DataSource = table4;
dataGridView3.DataSource = bs4;
connect.Close();
}
private void button1_Click(object sender, EventArgs e)
{
//????????? ?????? ??????: ?? ??????? ?????? ????????? ??????? ? ???
connect.Open();
SqlDataAdapter adapter5 = new SqlDataAdapter("SELECT FIO, Telefon FROM Klient", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("SELECT FIO, Telefon FROM Klient", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
connect.Close();
}
private void button2_Click(object sender, EventArgs e)
{
//????????? ?????? ??????: ?? ?????? ?????? ? ?????? ??????? ???????? ?????? ? ??? ???????
connect.Open();
SqlDataAdapter adapter5 = new SqlDataAdapter("SELECT Opisanie, FIO FROM Usluga, Klient WHERE [N uslugi]=[N klienta] ORDER BY FIO", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("SELECT Opisanie, FIO FROM Usluga, Klient WHERE [N uslugi]=[N klienta] ORDER BY FIO", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
connect.Close();
}
private void button3_Click(object sender, EventArgs e)
{
//????????? ?????? ??????: ?? ?????? ?????? ? ?????? ??????? ??? ??????? ? ????
connect.Open();
SqlDataAdapter adapter5 = new SqlDataAdapter("SELECT FIO, Data FROM Sdelka, Klient WHERE Klient.[N klienta]=[N sdelki]", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("SELECT FIO, Data FROM Sdelka, Klient WHERE Klient.[N klienta]=[N sdelki]", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
connect.Close();
}
private void button4_Click(object sender, EventArgs e)
{
string Nkl = "";
string FIO = "";
string Viddet = "";
string Adr = "";
string Tel = "";
string sum = "";
Nkl = Convert.ToString(textBox1.Text);
FIO = Convert.ToString(textBox2.Text);
Viddet = Convert.ToString(textBox3.Text);
Adr = Convert.ToString(textBox4.Text);
Tel = Convert.ToString(textBox5.Text);
sum = "('"+ Nkl + "', '" + FIO + "', '" + Viddet + "', '" + Adr + "', '" + Tel+"')";
connect.Open();
try
{
//????????? ?????? ? ??????? ??????
SqlDataAdapter adapter5 = new SqlDataAdapter("INSERT INTO Klient VALUES " + sum, connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("INSERT INTO Klient VALUES " + sum, connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
//??????? ??????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Klient", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Klient", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView1.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!","?????? ?????");
}
connect.Close();
}
private void button5_Click(object sender, EventArgs e)
{
string Nsk = "";
string Vsk = "";
int Rsk;
string sum = "";
Nsk = Convert.ToString(textBox6.Text);
Vsk = Convert.ToString(textBox7.Text);
Rsk = (int) Convert.ToInt32(textBox8.Text);
sum = "('" + Nsk + "', '" + Vsk + "', '";
connect.Open();
try
{
//????????? ?????? ? ??????? ??????
SqlDataAdapter adapter7 = new SqlDataAdapter("INSERT INTO Skidka VALUES " + sum + Rsk +"')", connect);
DataSet ds7 = new DataSet();
SqlCommand comm7 = new SqlCommand("INSERT INTO Skidka VALUES " + sum + Rsk + "')", connect);
adapter7.SelectCommand = comm7;
DataTable table7 = new DataTable();
table7.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter7.Fill(table7);
BindingSource bs7 = new BindingSource();
bs7.DataSource = table7;
dataGridView5.DataSource = bs7;
//??????? ??????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Skidka", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Skidka", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView2.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!", "?????? ?????");
}
connect.Close();
}
private void button6_Click(object sender, EventArgs e)
{
string Nusl = "";
string OpUsl = "";
string StUsl = "";
string sum = "";
Nusl = Convert.ToString(textBox9.Text);
OpUsl = Convert.ToString(textBox10.Text);
StUsl = Convert.ToString(textBox11.Text);
sum = "('" + Nusl + "', '" + OpUsl + "', '" + StUsl + "')";
connect.Open();
try
{
//????????? ?????? ? ??????? ??????
SqlDataAdapter adapter5 = new SqlDataAdapter("INSERT INTO Usluga VALUES " + sum, connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("INSERT INTO Usluga VALUES " + sum, connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
//??????? ??????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Usluga", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Usluga", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView3.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!", "?????? ?????");
}
connect.Close();
}
private void button7_Click(object sender, EventArgs e)
{
string Nsd = "";
string Nsk = "";
string Nusl = "";
string Nkl = "";
string Data = "";
string SumSd = "";
string Kom = "";
string sum = "";
Nsd = Convert.ToString(textBox12.Text);
Nsk = Convert.ToString(textBox13.Text);
Nusl = Convert.ToString(textBox14.Text);
Nkl = Convert.ToString(textBox15.Text);
Data = Convert.ToString(textBox16.Text);
SumSd = Convert.ToString(textBox17.Text);
Kom = Convert.ToString(textBox18.Text);
sum = "('" + Nsd + "', '" + Nsk + "', '" + Nusl + "', '" + Nkl + "', '" + Data + "', '" + SumSd + "', '" + Kom + "')";
connect.Open();
try
{
//????????? ?????? ? ??????? ??????
SqlDataAdapter adapter5 = new SqlDataAdapter("INSERT INTO Sdelka VALUES " + sum, connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("INSERT INTO Sdelka VALUES " + sum, connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
//??????? ??????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Sdelka", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Sdelka", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView4.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!", "?????? ?????");
}
connect.Close();
}
private void button8_Click(object sender, EventArgs e)
{
//????????? ????????? ??????: ?? ??????? ?????? ??????? ???????????? ????????? ??????
connect.Open();
SqlDataAdapter adapter5 = new SqlDataAdapter("SELECT MAX([Stoimost uslugi]) FROM Usluga", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("SELECT MAX([Stoimost uslugi]) FROM Usluga", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
dataGridView5.Columns[0].HeaderCell.Value = "MAX";
connect.Close();
}
private void ?????ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void button9_Click(object sender, EventArgs e)
{
//????????? ????? ??????: ?? ??????? ?????? ??????? ????? ???? ??????
connect.Open();
SqlDataAdapter adapter5 = new SqlDataAdapter("SELECT SUM(SummaSdelki) FROM Sdelka", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("SELECT SUM(SummaSdelki) FROM Sdelka", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
dataGridView5.Columns[0].HeaderCell.Value = "?????";
connect.Close();
}
private void button10_Click(object sender, EventArgs e)
{
string ns = "";
int n;
ns = Convert.ToString(textBox19.Text);
connect.Open();
try
{
n = Convert.ToInt32(ns);
//??????? ?? ??????? ??????
SqlDataAdapter adapter5 = new SqlDataAdapter("DELETE FROM Klient WHERE [N klienta] = '" + n + "'", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("DELETE FROM Klient WHERE [N klienta] = '" + n + "'", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
//??????? ?????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Klient", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Klient", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView1.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!", "?????? ?????");
}
connect.Close();
}
private void button11_Click(object sender, EventArgs e)
{
string ns = "";
int n;
ns = Convert.ToString(textBox20.Text);
connect.Open();
try
{
n = Convert.ToInt32(ns);
//??????? ?? ??????? ??????
SqlDataAdapter adapter5 = new SqlDataAdapter("DELETE FROM Skidka WHERE [N skidki] = '" + n + "'", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("DELETE FROM Skidka WHERE [N skidki] = '" + n + "'", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
//??????? ?????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Skidka", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Skidka", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView2.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!", "?????? ?????");
}
connect.Close();
}
private void button12_Click(object sender, EventArgs e)
{
string ns = "";
int n;
ns = Convert.ToString(textBox21.Text);
connect.Open();
try
{
n = Convert.ToInt32(ns);
//??????? ?? ??????? ??????
SqlDataAdapter adapter5 = new SqlDataAdapter("DELETE FROM Usluga WHERE [N uslugi] = '" + n + "'", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("DELETE FROM Usluga WHERE [N uslugi] = '" + n + "'", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
//??????? ?????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Usluga", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Usluga", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView3.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!", "?????? ?????");
}
connect.Close();
}
private void button13_Click(object sender, EventArgs e)
{
string ns = "";
int n;
ns = Convert.ToString(textBox22.Text);
connect.Open();
try
{
n = Convert.ToInt32(ns);
//??????? ?? ??????? ??????
SqlDataAdapter adapter5 = new SqlDataAdapter("DELETE FROM Sdelka WHERE [N sdelki] = '" + n + "'", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("DELETE FROM Sdelka WHERE [N sdelki] = '" + n + "'", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
//??????? ?????????? ???????
SqlDataAdapter adapter6 = new SqlDataAdapter("SELECT * FROM Sdelka", connect);
DataSet ds6 = new DataSet();
SqlCommand comm6 = new SqlCommand("SELECT * FROM Sdelka", connect);
adapter6.SelectCommand = comm6;
DataTable table6 = new DataTable();
table6.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter6.Fill(table6);
BindingSource bs6 = new BindingSource();
bs6.DataSource = table6;
// dataGridView5.DataSource = bs6;
dataGridView4.DataSource = bs6;
}
catch
{
MessageBox.Show("?? ????? ???????? ????????!", "?????? ?????");
}
connect.Close();
}
private void button14_Click(object sender, EventArgs e)
{
//????????? ?????? ??????: ?? ??????? ?????? ??????? ????? ?????? ??? ???????????
connect.Open();
SqlDataAdapter adapter5 = new SqlDataAdapter("SELECT SummaSdelki, Komissionie, (SummaSdelki-Komissionie) FROM Sdelka", connect);
DataSet ds5 = new DataSet();
SqlCommand comm5 = new SqlCommand("SELECT SummaSdelki, Komissionie, (SummaSdelki-Komissionie) FROM Sdelka", connect);
adapter5.SelectCommand = comm5;
DataTable table5 = new DataTable();
table5.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter5.Fill(table5);
BindingSource bs5 = new BindingSource();
bs5.DataSource = table5;
dataGridView5.DataSource = bs5;
dataGridView5.Columns[2].HeaderCell.Value = "??? ????????????";
connect.Close();
}
private void ??????????ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form f2;
f2 = new Form2();
f2.Show(this);
}
private void ????????ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form f3;
f3 = new Form3();
f3.Show(this);
}
private void ???????????????????????ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form f4;
f4 = new Form4();
f4.Show(this);
}
}
}
15
28
Документ
Категория
Без категории
Просмотров
869
Размер файла
398 Кб
Теги
moe_pz
1/--страниц
Пожаловаться на содержимое документа