private void Bill_Output_Page_Load_1(object sender, EventArgs e) { try { crypt.Load(@"C:\Users\Prageeth Thilina\source\repos\Group Project\Group Project\Bill_Report.rpt"); Connection2 con2 = new Connection2(); DataSet dst = new DataSet(); con2.dataGet2("select top 1 Customer_Name,Date,Sub_Total,Discount,Net_Total,Paid,Balance from Billing_Details order by Date desc"); con2.sda2.Fill(dst, "Billing_Details"); crypt.SetDataSource(dst); crystalReportViewer1.ReportSource = crypt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (Validation()) { DialogResult dr = MessageBox.Show("Are you sure want to Save Record", "Polkotuwa Stores", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { Connection2 con2 = new Connection2(); con2.dataSend2("insert into [dbo].[SupDetails] (SupID,SupName,SupNum,SupAdd) values('" + txtID.Text.ToString() + "', '" + txtName.Text.ToString() + "', '" + txtConNum.Text.ToString() + "', '" + txtAdd.Text.ToString() + "')"); MessageBox.Show("Record Saved Successfully....!!!", "Polkotuwa Stores", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearData(); } disp_data(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }