close

Вход

Забыли?

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

?

Пояснительная записка к курсвой работе Григорьевой Нины 8к10 автосервис

код для вставкиСкачать
???????????? ??????????? ? ????? ?????????? ?????????
??????????????? ??????????????? ?????????? ??????? ????????????????? ???????????
??????????? ?????????????????
??????? ??????????????? ???????????
------------------------------------------------------------------------------------------
???????? ???????????, ??????? ???
???????? ?????? ?? ?????????? "????????-??????????????? ????????????????"
???????? ???????????? ?????? ?? ???? "??????????? ?????? ???????????"
???????????:????????? ?????? 8?10 ?????????? ?.?.
????????????:????????? ??????? ??? ????????? ?.?.
?????? _________________________
???????_______________________
"____" _________________ 2012 ?.
????? 2012
??????????
1. ???????3
2. ????????? ???????3
3. ???????? ??????????????? ????????? ? ????? ?????? ????????????4
4. ???????? ??????????????? ????????? ? ????? ?????? ????????????5
5. ????????? ?????????? ??????????? ???????6
5.1 ???????? ???? ?????? ? Access6
5.2 ?????????? ????????? ???????.8
5.3 ???????? ????????? ??? ???????? ?????? ?? ?????? ? ??????????11
5.4 ?????????????? ?????????? ????????????14
6. ?????? ???????????? ??????????18
7. ??????????19
1. ???????
??????????? ??????????? ?????? "??????????? ?????? ???????????".
2. ????????? ???????
?????????? ?????? ???????? ?????????????????? ???????, ??????? ????? ?? ?????????????? ??? ?????????????????? ?????? ??????? ?????? ?????? ?? ???????????? ? ???????????.
?????????????????? ???????? ? ????????? ?????????? ????? ???????? ?????????? ???????????? ???????????? ?????????? ??????.
????? ???????, ???????? ??????? ??? ?????????? ??????? ??????? ???????? ?????????? ?????? ? ???????????.
????????? ??????? ?? ?????????? ????. ??? ??????? ?????????? ??????????? ??????? ?????, ? ??????? ???????????? ?????? ???????? ???????????, ??? ?? ???? ???????? ? ???? ????? ?????????? ???????, ?????? ?????????? ?????? ? ?? ??????, ???????? ?????????? ? ???????? ? ?? ??????, ?????????? ????? ???????, ??????? ????????? ? ??????????. ????????? ??????????? ? ????? Visual Studio .NET ?? ????? C#.
3. ???????? ??????????????? ????????? ? ????? ?????? ????????????
????????? ???????????? ??????????? ? ??????????? ??????. ? ??????? ???? ????? ????????? ?????? ???????? ?? ???? ??????. ?????? ????????????? ?????????? ? ????? ?????????? ?????????? ???????. ? ? ??????? ???? ????????????? ??????: ?????????? ? ???????; ???????? ???????; ??????? ???????; ???????? ??????????. ? ????? ?????? ???????????? ????????? ???????????? ????????? ????????? ??????? ?????????????:
> ???????? ???????? ? ??????? ? ??? ??????
> ?????????? ?????? ??????? ? ??? ?????? ? ???? ?????? > ???????? ??????? ? ??? ?????? ?? ???? ??????
> ?????????? ?????? ???????? ? ??? ??????
??????????? ?????????? ????????? ?????????? ??? ???????? ???????? ????.
4. ???????? ??????????????? ????????? ? ????? ?????? ????????????
4.1. ????????? ????????????? ????????? ????????? ???????? ??????? ?????? ?????. ???????? ????????? ????????? ???????? ?????? ???????? ???? ?????? Form1.cs. ??? ???????? ??????? ???????? ???? ????????? ????????? ???????? ????????. ?????? OleDbConnection ?????? Connection.
public static OleDbConnection myCon = new OleDbConnection();
??????? ????? ???????? ??????? ????????? ??????????? ?????????: ??????, ??????, ?????????, ????????? ????. 4.2. ???????
1.? ????????? ???????????? ??????? Click, ???????????? ??? ??????? ??????. ????? ??????????? ?????? ??????????? ????? ??????? ? ???? ??????:
private void button3_Click(object sender, EventArgs e)
{
UpdateCustomersList();
}
2. ? ????????? ???????????? ??????? SelectedIndexChanged, ???????????? ??? ????????? ??????? ?? ??????. ????? ??????????? ?????? ??????????? ????? ??????? ? ???? ??????:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string cmd = "select * from Customers where CustomerNumber=" + listBox1.SelectedValue.ToString();
OleDbCommand com = new OleDbCommand(cmd, myCon);
myCon.Open();
OleDbDataReader reader = com.ExecuteReader();
reader.Read();
textBox1.Text = reader["Avto"].ToString();
reader.Close();
myCon.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
4.3. ??????
? ????????? ??????????? ???????? ?????, ??????????? ???????? Main().
5. ????????? ?????????? ??????????? ???????
5.1 ???????? ???? ?????? ? Access ??? ???????? ?????????? ??????? " ??????????? ?????? ??????????? " ???? ??????? 2 ???????:
> Customers.mdb ???????? ? ???? ?????? ??? ???? ????????, ??????? ?????. ??????? ????? ????????? ????: ??? ???????(CustomerNumber) (????????), ???(Fio), ????? ??????????(Avto).
> Type_of_service.mdb ???????? ? ???? ?????????? ? ????? ????? ??????? ???????????. ??????? ????? ????????? ????: ??? ??????(ServiceCode) (????????); ??? ??????? (CustomerNumber), ??? ??????(Service), ????????? ?????? (Price), ???? ??????(Date).
???. 1 ????? ?????? ?????? ? Access
???. 2. ??????? Customers.mdb
???. 3. ??????? Type_of_service.mdb
5.2 ?????????? ????????? ???????.
? ???????????? ? ????????? ?????????? ?????????? ???? ?????? ???? ??????????? ?????? ??????????? ??? ?????? ????????? ? C#. ??? ??????? ?????????? ??????? ?? ???????? 4 ??????, ????? ??????? 2 ??????? ? 2 ???????????.
> ????? ??????? (Person);
> ????? ??????????? (Construction);
> ????? ??????? (Customers);
> ????? ??? ?????? (Type_of_Service).
????? ??????? (Person) - ???? ?? ??????? ???????, ??????? ????? ???????? ???? ? ???????? ??? ??????????? ???? ????? ? ?????? ???????.
class Person
{
private String fio;
private String marka;
public Person(String FIO, String Marka)
{
fio = FIO;
marka = Marka;
}
public Person() { }
public String FIO
{
get { return fio; }
set { fio = value; }
}
public string Marka
{
get { return marka; }
set { marka = value; }
}
public virtual String getInformation()
{
return fio + marka;
}
public int getDepth()
{ return 0; }
}
????? ??????????? (Construction) ???????? ????? ??????? ???????, ??????? ???????? ???? ? ???????? ??? ??????????? ???? ????? ? ?????? ???????.
class Construction
{
private string name;
private string number;
private string serviceC;
public Construction(String Name, String Number, String ServiceC)
{
name = Name;
number = Number;
serviceC = ServiceC;
}
public Construction() { }
public String Name
{
get { return name; }
set { name = value; }
}
public String Code
{
get { return number; }
set { number = value; }
}
public String ServiceC
{
get { return serviceC; }
set { serviceC = value; }
}
public virtual String getInformation()
{
return name + number + serviceC;
}
public int getDepth()
{
return 0;
}
}
????? ??????? (Customers) - ??? ?????-????????? ?? ?????? Person ??????????? ??????? - ???????? ???????????.
?????? ????? ????? ????????? ???????? ????: CustomerNumber (??? ???????), FIO (???), Avto (????? ??????????), ????? ?????? ???????? ???????????.
class Customers : Person
{
public string CustomerNumber { get; set; }
public string FIO { get; set; }
public string Avto { get; set; }
List<Customers> customer = new List<Customers>();
}
????? ??? ?????? (Type_of_Service) - ??? ?????-????????? ?????? Construction, ????????? ??????? - ??? ?????. ???? ????? ????? ????????? ???????? ????: ServiceCode (??? ??????), CustomerNumber (??? ???????), Service (???? ??????), ????? ?????? ????? ???????? ?????? ??????????????? ?????.
class Type_of_Service : Construction
{
public string ServiceCode { get; set; }
public string CustomerNumber { get; set; }
public string Service { get; set; }
List<Type_of_Service> usluga = new List<Type_of_Service>();
}
????????? ?????? ????? ????????:
???. 4 ClassDiagram1.cd
5.3 ???????? ????????? ??? ???????? ?????? ?? ?????? ? ??????????
??????????? ?????????? ????????? ????????? ?????? ? ?????? ?????? (??), ?????????????? ???? ???????? ?? ?????????? ??????? ???? ?? ????????? ????????. ??? ???? ????? ? ??????? ?????????? FCL ??????? ????? ??????? ???????????? ???? System.Data, ??????? ?????????? ??????????? ADO.NET. ?????? ?????????? ????????????? ??????? ? ??????????, ?? ?????? ???????? ??????? ? ??????, ? ??????? ??????? ????? ??????????? ????? ???????????? ??????? ???????. ?????? ?????????? ????????? ??????????? ??? ?????? ?????? ? ???????: ?????????????? ? ????????????? ??????.
? ?????? ???????? ?????? ??? ?????????????? ?????????? ?? ???????????? ?????????????? ?????. ??? ?????? ? ????? ?????? ???????????? ?????? ?? ???????????? ???? System.Data.OleDb:
OleDbConnection:
OleDbConnection ????????????? ?????????? ? ????? ??????. ? ???????????? ?????? ????? ???????? ?????? ? ??????????? ?????????? ????:
private string ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; data source=AvtoService.accdb";
?????? ????????????? OleDbConnection ? ?????? ??????:
myCon = new OleDbConnection(ConnectionString);
myCon.Open();
OleDbCommand:
OleDbCommand ???????????? ??? ?????????? ?????? ?? ?????? ? ???????. ????? ???????????? ????????? ??????? ????????????? ?????? ? ?????? ?????? 1. SQL-??????? ??? ???????:
string cmd = "select * from Customers where CustomerNumber=" + listBox1.SelectedValue.ToString();
2. SQL-??????? ??? ??????????:
Cmd = "INSERT INTO Customers (CustomerNumber, FIO, Avto ) values('" + textBox4.Text + "','" + textBox1.Text + "', '" + textBox2.Text + "') ";
3. SQL-??????? ??? ????????:
string Cmd = "delete * from Customers where CustomerNumber=" + listBox1.SelectedValue;
OleDbDataReader:
OleDbDataReader ???????????? ??? ????????? ?????????? ??????????? ???????. ?????? ???? OleDbDataReader ????? ????????, ?????? ????? ExecuteReader() ?????? OleDbCommand.
OleDbDataReader ???????? ????? ???????. ????? Read() ????????? ??????? ? ????????? ?????? ?????? ? ?????????? false, ???? ??????? ????????? ?????? ? ?????????? ?????? ??????. OleDbDataReader ????????? ????????? ??????? ??? ?????? ?????? ??????? ???? ?? ????????? ??????.
?????? ????????????? ? ?????? ??????:
myCon = new OleDbConnection(ConnectionString);
myCon.Open();
OleDbCommand myCommand = new OleDbCommand("SELECT * FROM Customers", myCon);
myCommand.Connection = myCon;
OleDbDataReader myReader = myCommand.ExecuteReader();
List<Customers> customer = new List<Customers>();
while (myReader.Read())
{
Customers cl = new Customers();
cl.FIO = myReader["FIO"].ToString();
cl.CustomerNumber = myReader["CustomerNumber"].ToString();
cl.Avto = myReader["Avto"].ToString();
customer.Add(cl);
}
myReader.Close();
myCon.Close();
}
5.4 ?????????????? ?????????? ????????????
??? ???? ????? ? ?????? ?????????? ??? ????? ???????? ??????? ????????????, ????????? ??????????? ?????????. ????????? .Net ????????????? ????? ????????-??????????????? ??????? ??? ??????? ? ??????? ?????????? ???? ?????? ???????????? ??????????. ????????? ?????????? ???????????? ?????????? ???????? ??????????? ??????, ?????????? ?????????? ?????????? (??), ??????? ???????? ????? ?????????????:
1. ????????? ?????? ? ?????????? ?????? ???? ?? Windows;
2. ???????????? ?????? ? ???? ???????:
* ????? ?????????????? (design mode), ? ??????? ? ???? ???????? ????? ??????????;
* ????? ?????????? (run mode), ? ??????? ??????????? ?????????????? ????????????? ? ??.
??????? ??????? ??? ???? ????????? ?????????? ???????? ????? Control, ??????????? ????? ??????? ????????????????. ????? Control ?????? ?????? ????????, ?????? ? ???????, ??????????? ????? ??? ?????????. ??? ?????? ????????? ?????????? (??) ???????? ???????????? ?????? Control. ??????? ????? Control ???????? ?????????? ??????? ????????? (79 ???????, 56 ???????, 67 ???????), ??????? ???????? ?? ???? ??????????? ???????.
5.4.1 ?????????? ???? ??????? ????? Form1.cs ???????????? ??? ??????? ?????????. ?? ?????, ????? ????????? ?????? ???????? ?? ???? ??????. ?????? ????????????? ?????????? ? ????? ?????????? ?????????? ???????. ? ? ??????? ???? ????????????? ??????: ?????????? ? ???????; ???????? ???????; ??????? ???????; ???????? ??????????. ???. 5 Form1.cs
??? ??????? ?? ?????? "?????????? ? ???????" ?????????? Form2.cs, ??? ????????????? ????, ? ??????? ?????????: ??? ?????????? ?? ?????? ???????, ????? ??? ??????????, ??? ??????????????? ??????, ???? ?????? ??????, ????????? ?????? ? ????????? ???? ??????????????? ????? ??????. ???. 6 Form2.cs
? ???? "?????????? ? ???????" ??????????? ?????? "??????", ??? ??????? ?? ???????, ?????? ???????????? ?? ??????.
???. 7 Form2.cs (??????)
??? ??????? ?? ?????? "???????? ???????" ?????????? Form3.cs, ??? ????????????? ????, ? ??????? ?????????? ???????: ??? ???????, ??? ???????, ????? ??? ??????????, ??? ??????????????? ?????? ? ????????? ??????. ???. 8 Form3.cs ????? ??????? ?????? "????????", ?????? ? ??????????????? ?????? ????? ???????? ? ???? ?????? ???????? ? ??????????? ? ?????? ?? ??????? ????? (?????? ????? ?????????? ??????, ???????? ?????? "???????? ??????????").
???. 9 (???????? ?????????? ???????) ???? ????????????? ?????? "??????? ???????". ??? ??????? ?? ?????? "??????? ???????", ?? ?????? ????????? ????????? ?????? ? ??? ??? ??????. 6. ?????? ???????????? ??????????
1. ????????? ?.?. ??????????????? ?????? ??????????? ? ????????????????. - ?????: ???-?? ???, 2009. - 200?.
2. ?????? ?. ?. ?????? ???????????????? ?? C#. - ?.: ???-?? "????????-??????????? ?????????????? ??????????", 2006. - 488 c.
3. ???? ?. C#. ????????? ????????????????. ???????????? ????????????. - ????: "???????", 2002. - 656 ?.
4. ????????? ?.?., ??????? ?.?., ???????? ?.?.. ???????????? ?????????? ? ???????? ??????? - ?.:????, 1997. - 198 ?.
5. ????? ?.?????????? ?????????? ???????????? ???????????. ???????. - ???.: ?????, 2002. - 464 ?.
7. ??????????
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace AvtoService
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
class Person
{
private String fio;
private String marka;
public Person(String FIO, String Marka)
{
fio = FIO;
marka = Marka;
}
public Person() { }
public String FIO
{
get { return fio; }
set { fio = value; }
}
public string Marka
{
get { return marka; }
set { marka = value; }
}
public virtual String getInformation()
{
return fio + marka;
}
public int getDepth()
{ return 0; }
}
class Construction
{
private string name;
private string number;
private string serviceC;
public Construction(String Name, String Number, String ServiceC)
{
name = Name;
number = Number;
serviceC = ServiceC;
}
public Construction() { }
public String Name
{
get { return name; }
set { name = value; }
}
public String Code
{
get { return number; }
set { number = value; }
}
public String ServiceC
{
get { return serviceC; }
set { serviceC = value; }
}
public virtual String getInformation()
{
return name + number + serviceC;
}
public int getDepth()
{
return 0;
}
}
class Customers : Person
{
public string CustomerNumber { get; set; }
public string FIO { get; set; }
public string Avto { get; set; }
List<Customers> customer = new List<Customers>();
}
class Type_of_Service : Construction
{
public string ServiceCode { get; set; }
public string CustomerNumber { get; set; }
public string Service { get; set; }
List<Type_of_Service> usluga = new List<Type_of_Service>();
}
Form1.cs
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Data.OleDb;
namespace AvtoService
{
public partial class Form1 : Form
{
public static OleDbConnection myCon = new OleDbConnection();
private string ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; data source=AvtoService.accdb";
public Form1()
{ InitializeComponent();
myCon = new OleDbConnection(ConnectionString);
//UpdateCustomersList();
myCon.Open();
OleDbCommand myCommand = new OleDbCommand("SELECT * FROM Customers", myCon);
myCommand.Connection = myCon;
OleDbDataReader myReader = myCommand.ExecuteReader();
List<Customers> customer = new List<Customers>();
while (myReader.Read())
{ Customers cl = new Customers();
cl.FIO = myReader["FIO"].ToString();
cl.CustomerNumber = myReader["CustomerNumber"].ToString();
cl.Avto = myReader["Avto"].ToString();
customer.Add(cl);
}
myReader.Close();
myCon.Close();
listBox1.DisplayMember = "FIO";
listBox1.ValueMember = "CustomerNumber";
listBox1.DataSource = customer;
listBox1.SelectedIndex = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{ try
{
string cmd = "select * from Customers where CustomerNumber=" + listBox1.SelectedValue.ToString();
OleDbCommand com = new OleDbCommand(cmd, myCon);
myCon.Open();
OleDbDataReader reader = com.ExecuteReader();
reader.Read();
textBox1.Text = reader["Avto"].ToString();
reader.Close();
myCon.Close();
}
catch (Exception ex)
{ Console.WriteLine(ex.Message);
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
if (listBox1.SelectedValue == null) return;
Form2 frm = new Form2((Convert.ToInt32(listBox1.SelectedValue)).ToString());
frm.ShowDialog();
} private void button2_Click(object sender, EventArgs e)
{
string Cmd = "delete * from Customers where CustomerNumber=" +
Convert.ToInt32(listBox1.SelectedValue);
OleDbCommand myCom4 = new OleDbCommand(Cmd, myCon);
myCon.Open();
myCom4.ExecuteNonQuery();
List<Customers> customer = new List<Customers>();
Cmd = "select * from Customers";
OleDbCommand com = new OleDbCommand(Cmd, myCon);
OleDbDataReader myReader = com.ExecuteReader();
while (myReader.Read())
{
Customers cl = new Customers();
cl.FIO = myReader["FIO"].ToString();
cl.CustomerNumber = myReader["CustomerNumber"].ToString();
customer.Add(cl);
}
myReader.Close();
myCon.Close();
listBox1.DisplayMember = "FIO";
listBox1.ValueMember = "CustomerNumber";
listBox1.DataSource = customer;
if (((List<Customers>)listBox1.DataSource).Count > 0)
listBox1.SelectedIndex = 0;
} private void button3_Click(object sender, EventArgs e)
{
UpdateCustomersList();
}
public void UpdateCustomersList()
{
myCon.Open();
List<Customers> customer = new List<Customers>();
string Cmd = "select * from Customers";
OleDbCommand com = new OleDbCommand(Cmd, myCon);
OleDbDataReader myReader = com.ExecuteReader();
while (myReader.Read())
{
Customers cl = new Customers();
cl.FIO = myReader["FIO"].ToString();
cl.CustomerNumber = myReader["CustomerNumber"].ToString();
customer.Add(cl);
}
myReader.Close();
myCon.Close();
listBox1.DisplayMember = "FIO";
listBox1.ValueMember = "CustomerNumber";
listBox1.DataSource = customer;
if (((List<Customers>)listBox1.DataSource).Count > 0) {
listBox1.SelectedIndex = 0;
}
}
private void button4_Click(object sender, EventArgs e)
{
Form3 frm2 = new Form3();
frm2.ShowDialog(); }
private void label2_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
Form2.cs
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Drawing.Printing;
namespace AvtoService
{
public partial class Form2 : Form
{ List<string> usl = new List<string>();
List<int> price = new List<int>();
List<string> dat = new List<string>();
public Form2(string customerNumber)
{ InitializeComponent();
string cmd = "select * from Customers where CustomerNumber = " + customerNumber;
OleDbCommand com = new OleDbCommand(cmd, Form1.myCon);
Form1.myCon.Open();
OleDbDataReader reader = com.ExecuteReader();
reader.Read();
textBox1.Text = reader["FIO"].ToString();
textBox2.Text = reader["Avto"].ToString();
reader.Close();
com.CommandText = "select * from Type_of_service where CustomerNumber = " + customerNumber;
reader = com.ExecuteReader();
int sum = 0;
while (reader.Read())
{ string s = reader["Service"].ToString();
string d = reader["Date"].ToString();
int k = Convert.ToInt32(reader["Price"]);
sum += k;
price.Add(k);
usl.Add(s);
dat.Add(d);
}
textBox5.Text = sum.ToString();
listBox1.DataSource = usl;
Form1.myCon.Close();
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{ }
private void Form2_Load(object sender, EventArgs e)
{ }
private void textBox1_TextChanged(object sender, System.EventArgs e)
{ }
private void textBox2_TextChanged(object sender, System.EventArgs e)
{
}
private void textBox3_TextChanged(object sender, System.EventArgs e)
{
}
private void textBox4_TextChanged(object sender, System.EventArgs e)
{
}
private void textBox5_TextChanged(object sender, System.EventArgs e)
{
}
private void button3_Click(object sender, System.EventArgs e)
{
PrintDocument d = new PrintDocument();
d.DocumentName = "??????";
d.Print();
}
private void button2_Click(object sender, System.EventArgs e)
{
Visible = false;
}
private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
int ind = listBox1.SelectedIndex;
textBox4.Text = price[ind].ToString();
textBox3.Text = dat[ind].ToString();
}
}
}
Form3.cs
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Data.OleDb;
namespace AvtoService
{
public partial class Form3 : Form
{
List<string> usl = new List<string>();
public Form3()
{
InitializeComponent();
Form3_Load(new Object(), new EventArgs());
}
private void Form3_Load(object sender, EventArgs e)
{
string Cmd1;
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; data source=AvtoService.accdb";
Cmd1 = "SELECT Service FROM Type_of_Service";
OleDbCommand myCom1 = new OleDbCommand(Cmd1, connection);
connection.Open();
OleDbDataReader reader = myCom1.ExecuteReader();
List<Type_of_Service> usluga = new List<Type_of_Service>();
while (reader.Read())
{
Type_of_Service u = new Type_of_Service();
u.Service = reader["Service"].ToString();
usluga.Add(u);
}
reader.Close();
connection.Close();
comboBox1.DataSource = usluga;
comboBox1.DisplayMember = "Service";
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string oo = comboBox1.Text;
// int pp = comboBox1.SelectedIndex;
string Cmd;
Cmd = "INSERT INTO Customers (CustomerNumber, FIO, Avto ) values('" + textBox4.Text + "','" + textBox1.Text + "', '" + textBox2.Text + "') ";
string Cmd10 = "INSERT INTO Type_of_service (CustomerNumber, Service, Price) values('" + textBox4.Text + "','" + oo + "', '" + textBox3.Text + "') ";
OleDbConnection myCon = new OleDbConnection();
myCon.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; data source=AvtoService.accdb";
OleDbCommand myCom2 = new OleDbCommand(Cmd, myCon);
OleDbCommand myCom3 = new OleDbCommand(Cmd10, myCon);
myCon.Open();
myCom2.ExecuteNonQuery();
myCon.Close();
myCon.Open();
myCom3.ExecuteNonQuery();
myCon.Close();
Close();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
1
Документ
Категория
Без категории
Просмотров
41
Размер файла
833 Кб
Теги
автосервис, курсвой, пояснительная, записка, 8к10, работа, григорьева, нины
1/--страниц
Пожаловаться на содержимое документа