public void InsertWC(WorkingCart123 p) { try { command.CommandText = "INSERT INTO Workingcard(id_WorkingCard, [Begin], [End], WorkingTask, [Status], [Taskdescription], [Username]) VALUES (" + p.id_WorkingCart + "," + "'" + p.begin + "'" + "," + "'" + p.end + "'" + "," + p.taskName + "," + "'" + p.status + "'" + "," + "'" + p.description + "'" + "," + "'" + p.username + "')"; command.CommandType = CommandType.Text; connection.Open(); command.ExecuteNonQuery(); } catch (Exception) { //throw; MessageBox.Show("Некоректни данни! Моля въведете отново!"); } finally { if (connection != null) { connection.Close(); } } }
private void button4_Click(object sender, EventArgs e) { WorkingCart123 p = new WorkingCart123(); //p.id_WorkingCart = textBox1.Text; //p.begin = dateTimePicker1.Text; //p.end = dateTimePicker2.Text; //p.status = comboBox2.Text; //p.description = textBox4.Text; //p.username = textBox5.Text; //b.UpdateWC(p); }
private void button1_Click(object sender, EventArgs e) { WorkingCart123 p = new WorkingCart123(); p.id_WorkingCart = textBox1.Text; p.begin = dateTimePicker1.Text; p.end = dateTimePicker2.Text; p.taskName = comboBox1.Text; p.status = comboBox2.Text; p.description = textBox4.Text; p.username = comboBox3.Text; b.InsertWC(p); }
public void UpdateWC(WorkingCart123 p) { try { //command.CommandText = "UPDATE Employee SET Username='******'" + p.FirstName + "," + " LastName=" + "'" + p.LastName + "," + " Position=" + "'" + p.Position + "," + " Lastaction=" + "'" + p.Lastaction + "'" + " WHERE Username="******"Некоректни данни! Моля въведете отново!"); } finally { if (connection != null) { connection.Close(); } } }