public static void AddProject(string ProjectName, int YearOfProject, string ProjectDescription, bool IsActive = true) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = new NuRacingDataSet.ProjectDataTable(); projectAdapter.Fill(projectTable); NuRacingDataSet.ProjectRow newProjectRow = projectTable.NewProjectRow(); newProjectRow.Project_Name = ProjectName; newProjectRow.Project_YearMade = YearOfProject; newProjectRow.Project_Description = ProjectDescription; newProjectRow.Project_Active = IsActive; newProjectRow.Project_Status = "Planning"; newProjectRow.Project_StatusChangedDate = DateTime.Now; projectTable.AddProjectRow(newProjectRow); projectAdapter.Update(projectTable); }
static DesignBid() { // load data dsNBD = new NBD_DataSet(); ProjectTableAdapter daProject = new ProjectTableAdapter(); ClientTableAdapter daClient = new ClientTableAdapter(); WorkerTableAdapter daWorker = new WorkerTableAdapter(); MaterialReqTableAdapter daMatReq = new MaterialReqTableAdapter(); LabourReqTableAdapter daLabReq = new LabourReqTableAdapter(); try { daProject.Fill(dsNBD.Project); daClient.Fill(dsNBD.Client); daWorker.Fill(dsNBD.Worker); daMatReq.Fill(dsNBD.MaterialReq); daLabReq.Fill(dsNBD.LabourReq); } catch (DataException dex) { catcher = dex.Message; }// added a dex catcher }