private void POSItemListPrintReport_Load(object sender, EventArgs e) { try { this.StartPosition = FormStartPosition.Manual; this.Location = new Point(0, 0); POSItemListCrystalReport crystal = new POSItemListCrystalReport(); BillingPOSPrintDataSet ds = GetData(); crystal.SetDataSource(ds); this.crystalReportViewer1.ReportSource = crystal; this.crystalReportViewer1.RefreshReport(); } catch { } }
public Prlist(string str) { try { InitializeComponent(); rpt = new ReportDocument(); BillingPOSPrintDataSet ds = GetData(); rpt.Load(str); rpt.SetDataSource(ds.Tables["Printing"]); SetDBLogonForReport(rpt, ds); crystalReportViewer1.ReportSource = rpt; } catch { } }
private BillingPOSPrintDataSet GetData() { using ((constr)) { using (SqlCommand cmd = new SqlCommand("Select * from Printing")) {//SqlCommand cmd = new SqlCommand("select b.*,bp.* from billposmaster b inner join BillProductMaster bp on bp.BillId = b.BillId"); //SqlCommand cmd1 = new SqlCommand("Select * from BillMaster",con); SqlDataAdapter sda1 = new SqlDataAdapter(); cmd.Connection = constr; sda1.SelectCommand = cmd; using (BillingPOSPrintDataSet dspos = new BillingPOSPrintDataSet()) { sda1.Fill(dspos, "Printing"); return(dspos); } } } }
private BillingPOSPrintDataSet GetData() { using ((constr)) { //using (SqlCommand cmd = new SqlCommand("select billno,itemname,qty,unitprice,price,disamt,totalamt from itemdetails where billno='" + lblbillno.Text + "'")) using (SqlCommand cmd = new SqlCommand("select * from Printing")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = constr; sda.SelectCommand = cmd; using (BillingPOSPrintDataSet dspos = new BillingPOSPrintDataSet()) { sda.Fill(dspos, "Printing"); return(dspos); } } } } }