textBox7, false); Add +=textBox7. Text + »,»;} (! Int32. TryParse (textBox8. Text, out temp)) {Warning (textBox8, true); ++ warning;} {Warning (textBox8, false); Add +=textBox8. Text + »,»;} (! Double. TryParse (textBox9. Text, NumberStyles. Number, CultureInfo. InvariantCulture, out tempd)) {Warning (textBox9, true); ++ warning;}
{(textBox9, false); loopstr=textBox9. Text, str=«»; (char loopch in loopstr)
{ch=loopch; (ch == . ) ch= laquo ;, raquo ;; +=ch;
} +=«» + str + «,»;
} (textBox10. Text. Length == 0) {Warning (textBox10, true); ++ warning;} {Warning (textBox10, false); Add +=«» + textBox10. Text + «);»;} (warning gt; 0)
{. Show («Помилка. Невірний формат даних»);
return;
}
{= new MySqlConnection (sourse) ;. Open (); com=new MySqlCommand (Add, con); reader=com. ExecuteReader () ;. Show («Запис додана в таблицю»);
con. Close ();
} (Exception ex)
{(ex. Message. Contains («Duplicate entry»)) MessageBox. Show («Помилка. Запис з таким ID вже існує»);
else MessageBox. Show («Помилка: n» + ex. Message);
}. buttonShow_Click (this, new EventArgs ());
}
void buttonDelete_Click (object sender, EventArgs e)
{
//Видалення для виділеного рядка (dataGridView1. SelectedRows. Count gt; 0)
{str=«»; (int i=0; i lt; dataGridView1. SelectedRows. Count; ++ i) +=«id =» + dataGridView1. SelectedRows [i] .Cells [0] .Value + «or»;=str. Remove (str. Length - 3) ;. DataSource=GetTable (@ «delete from BD where» + str + »;»);
}
//Видалення для виділеної комірки
if (dataGridView1. SelectedCells. Count gt; 0)
{cells=dataGridView1. SelectedCells; str=«»; (int i=0; i lt; cells. Count; ++ i) +=«id =» + dataGridView1. Rows [cells [i] .RowIndex] .Cells [0] .Value + «or»;=str. Remove (str. Length - 3) ;. DataSource=GetTable (@ «delete from BD where» + str + »;»);
}. buttonShow_Click (this, new EventArgs ());
}
void buttonSearchAdd_Click (object sender, EventArgs e)
{. Rows. Add ();
}
void buttonSearchDelete_Click (object sender, EventArgs e)
{(dataGridView2. SelectedCells. Count gt; 0 || dataGridView2. SelectedRows. Count gt; 0)
{(dataGridView2. SelectedCells. Count gt; 0) (int i=0; i lt; dataGridView2. SelectedCells. Count; ++ i). Rows. RemoveAt (dataGridView2. SelectedCells [i] .RowIndex); (dataGridView2. SelectedRows. Count gt; 0) (int i=0; i lt; dataGridView2. SelectedRows. Count; ++ i). Rows. RemoveAt (dataGridView2. SelectedRows [i] .Index);
} dataGridView2. Rows. RemoveAt (dataGridView2. Rows. Count - 1);
}
void buttonSearch_Click (object sender, EventArgs e)
{andor=(radioButtonSearchAnd. Checked)? «AND»: «OR»; result=@ «select * from BD»; (dataGridView2. Rows. Count gt; 0) result +=«where»; (int i=0; i lt; dataGridView2. Rows. Count; ++ i)
{(i gt; 0) result += + Andor; +=«» + dataGridView2. Rows [i] .Cells [0] .Value + dataGridView2. Rows [i] .Cells [1] .Value + «» + dataGridView2. Rows [i] .Cells [2] .Value + «»;
} +=»;»;=new MySqlConnection (sourse);
{. Open () ;. DataSource=GetTable (result);
}
{. Show («Error: »);
}. Close ();
}
void checkBoxID_CheckedChanged (object sender, EventArgs e)
{. Enabled =! comboBoxID. Enabled;
}
void checkBoxColor_CheckedChanged (object sender, EventArgs e)
{. Enabled =! comboBoxColor. Enabled;
}
void checkBoxMatherial_CheckedChanged (object sender, EventArgs e)
{. Enabled =! comboBoxMatherial. Enabled;
}
void checkBoxNameItem_CheckedChanged (object sender, EventArgs e)
{. Enabled =! comboBoxNameItem. Enabled;
}
DataTable DT ()
{query=@ «select * from BD»; ID=comboBoxID. Enabled amp; amp; comboBoxID. Text!=«», Matherial=comboBoxMatherial. ...