-
Notifications
You must be signed in to change notification settings - Fork 2
/
frm16Viewer1.cs
48 lines (44 loc) · 1.81 KB
/
frm16Viewer1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace SA47Team10a_GalaxyLibrary
{
public partial class frm16Viewer1 : Form
{
public frm16Viewer1()
{
InitializeComponent();
}
private void crystalReportViewer1_Load(object sender, EventArgs e)
{
//GalaxyEntities context = new GalaxyEntities();
//CrystalReport1 cr = new CrystalReport1();
//cr.SetDataSource(context.Books);
//crystalReportViewer1.ReportSource = cr;
String cnS = "data source=(local);initial catalog=Galaxy;integrated security=SSPI;";
SqlConnection cn = new SqlConnection(cnS);
SqlCommand cm = new SqlCommand("Select * from Books", cn);
SqlDataAdapter da = new SqlDataAdapter(cm);
SqlCommandBuilder cmb = new SqlCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds, "Books");
CrystalReport1 cr = new CrystalReport1();
//int c = 0;
//c = ds.Tables["Transactions"].Rows.Count;
//SqlCommand cm1 = new SqlCommand("select Transactions.TransactionID, Transactions.MemberID, Transactions.BookID, Transactions.IssueDate, Transactions.DueDate from Transactions where Transactions.TransactionID ='" + c + "'",cn);
//SqlDataAdapter da1 = new SqlDataAdapter(cm1);
//SqlCommandBuilder cmb1 = new SqlCommandBuilder(da1);
//DataSet ds1 = new DataSet();
//da1.Fill(ds1, "Transactions");
cr.SetDataSource(ds.Tables["Books"]);
crystalReportViewer1.ReportSource = cr;
}
}
}