namespace AddProject_V2 { public partial class AddProjectfrm : Form { private string projectName; private string startDate; private string endDate; // AddProjectfrm initializes the instance variables for each project based on user input public AddProjectfrm() { InitializeComponent(); setProject(); conDB(); setWeeks(); } // setProject function sets the name, targets and job starts public void setProject() { this.projectName = projectNametxtbx.Text; target1Day = Convert.ToInt32(target1daytxtbx.Text); target2Day = Convert.ToInt32(target2daytxtbx.Text); startDate = startDatetimepcker.Value.ToString(); endDate = endDatetimepcker.Value.ToString(); } private void submittbtn_Click(object sender, EventArgs e) { conDB(); setProject(); totalTarget += target1Day + target2Day + target5Day + target10Day + target15Day; insertCommand = "INSERT into Project2(projectName, startDate, endDate, duration, targetOne, targetTwo, targetFive, targetTen, targetFifteen, targetTotal, totalWeeks, jobStarts)" + "VALUES" + "("+"'"+this.projectName+"'"+"," + "'" + startDate+"'"+","+"'"+endDate+"'"+","+"5"+","+this.target1Day+"," + this.target2Day+","+target5Day+","+target10Day+","+target15Day+ "," +totalTarget+","+"2"+","+this.jobStarts+")"; oldbCommand = new OleDbCommand(insertCommand, oldbCon); oldbAdapter = new OleDbDataAdapter(oldbCommand); dataSet = new DataSet(); oldbAdapter.Fill(dataSet, "Project2"); }