private void reportViewer1_Load(object sender, EventArgs e) { this.reportViewer1.LocalReport.DataSources.Clear(); DataTable table = new DataTable(hDPurchasingDataSet.Orders.ToString()); var reportAdapter = new HDPurchasingDataSetTableAdapters.OrdersTableAdapter(); reportAdapter.Fill(hDPurchasingDataSet.Orders); ReportDataSource reportDataSource = new ReportDataSource("dataset", table); this.reportViewer1.LocalReport.DataSources.Add(reportDataSource); this.reportViewer1.LocalReport.ReportPath = "C:/Users/TJ Musiitwa/Desktop/Assignments/Level 3/DBA-FYP/System/HDP-DBMSystem/HDP-DBMSystem/Order Purchase Report.rdlc"; this.reportViewer1.RefreshReport(); }
private void buttonPlaceOrder_Click(object sender, EventArgs e) { try { HDPurchasingDataSetTableAdapters.OrdersTableAdapter ordersTableAdapter = new HDPurchasingDataSetTableAdapters.OrdersTableAdapter(); ordersTableAdapter.Insert(orderedBy.Text, (Convert.ToDateTime(orderDateTime.Value)), orderDrug.Text, (Convert.ToInt32(drugOrderQuantity.Value)), (Convert.ToDecimal(orderTotalCost.Text))); MessageBox.Show("A new drug order has been placed"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); //throw; } }