Hi
How do I use Hi
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ClassBLL.cs
Copy
15 public void ChuanBi3Table(string MaHK)
16 {
17 //Table 1
18 string sql1 = " select MaSV,'sotinchi'=sum(SoTC) " +
19 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
20 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD and MaHK='" + MaHK + "' " +
21 " group by MaSV ";
22 DataTable dt1 = da.GetTable(sql1);
23 for (int i = 0; i < dt1.Rows.Count; i++)
24 {
25 string sql_1 = "Insert into Loptc values('" + dt1.Rows[i][0] + "'," + dt1.Rows[i][1] + ")";
26 da.ExcuteNonQuery(sql_1);
27 }
28 //Table 2
29 string sql2 = "select MaSV,'cuoiky'=sum(DiemTk10*SoTC) " +
30 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
31 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaHK='" + MaHK + "' " +
32 " group by MaSV ";
33 DataTable dt2 = da.GetTable(sql2);
34 for (int i = 0; i < dt2.Rows.Count; i++)
35 {
36 string sql_2 = "Insert into Lopdiem10 values('" + dt2.Rows[i][0] + "'," + dt2.Rows[i][1] + ")";
37 da.ExcuteNonQuery(sql_2);
38 }
39 //Table 3
40 string sql3 = " select Lopdiem10.MaSV,'TrungBinhCuoiKyHe10'=cuoiky/sotinchi " +
41 " from Lopdiem10 left join Loptc on Loptc.MaSV=Lopdiem10.MaSV";
42 DataTable dt3 = da.GetTable(sql3);
43 for (int i = 0; i < dt3.Rows.Count; i++)
44 {
45 string sql_3 = "Insert into DTB values('" + dt3.Rows[i][0] + "'," + dt3.Rows[i][1] + ")";
46 da.ExcuteNonQuery(sql_3);
47 }
48 }
File name: ClassBLL.cs
Copy
49 public void ChuanBi3Table()
50 {
51 //Table 1
52 string sql1 = " select MaSV,'sotinchi'=sum(SoTC) " +
53 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
54 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD " +
55 " group by MaSV ";
56 DataTable dt1 = da.GetTable(sql1);
57 for (int i = 0; i < dt1.Rows.Count; i++)
58 {
59 string sql_1 = "Insert into Loptc values('" + dt1.Rows[i][0] + "'," + dt1.Rows[i][1] + ")";
60 da.ExcuteNonQuery(sql_1);
61 }
62 //Table 2
63 string sql2 = "select MaSV,'cuoiky'=sum(DiemTk10*SoTC) " +
64 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
65 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD " +
66 " group by MaSV ";
67 DataTable dt2 = da.GetTable(sql2);
68 for (int i = 0; i < dt2.Rows.Count; i++)
69 {
70 string sql_2 = "Insert into Lopdiem10 values('" + dt2.Rows[i][0] + "'," + dt2.Rows[i][1] + ")";
71 da.ExcuteNonQuery(sql_2);
72 }
73 //Table 3
74 string sql3 = " select Lopdiem10.MaSV,'TrungBinhCuoiKyHe10'=cuoiky/sotinchi " +
75 " from Lopdiem10 left join Loptc on Loptc.MaSV=Lopdiem10.MaSV";
76 DataTable dt3 = da.GetTable(sql3);
77 for (int i = 0; i < dt3.Rows.Count; i++)
78 {
79 string sql_3 = "Insert into DTB values('" + dt3.Rows[i][0] + "'," + dt3.Rows[i][1] + ")";
80 da.ExcuteNonQuery(sql_3);
81 }
82 }
File name: ClassBLL.cs
Copy
213 public string TinhDiemTB(string MaSV, string MaHK)
214 {
215 SqlConnection con = da.GetConnect();
216 con.Open();
217 //view tc
218 string sql1 = " select 'sotinchi'=sum(SoTC) " +
219 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
220 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD and MaSV='"+MaSV+"' and MaHK='"+MaHK+"' " +
221 " group by MaSV ";
222 SqlCommand cmd1 = new SqlCommand(sql1, con);
223 string tc = cmd1.ExecuteScalar().ToString();
224 // view diem10
225 string sql2 = " select 'cuoiky'=sum(DiemTk10*SoTC) " +
226 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
227 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='"+MaSV+"' and MaHK='"+MaHK+"' " +
228 " group by MaSV ";
229 SqlCommand cmd2 = new SqlCommand(sql2, con);
230 string diem10 = cmd2.ExecuteScalar().ToString();
231 //view diem4
232 string sql3 = " select 'cuoiky'=sum(DiemTk4*SoTC) " +
233 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
234 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='"+MaSV+"' and MaHK='"+MaHK+"' " +
235 " group by MaSV ";
236 SqlCommand cmd3 = new SqlCommand(sql3, con);
237 string diem4 = cmd3.ExecuteScalar().ToString();
238
239
240 string ketqua="";
241 ketqua = Convert.ToDouble(diem10) / Convert.ToDouble(tc) + "," + Convert.ToDouble(diem4) / Convert.ToDouble(tc) ;
242 return ketqua;
243 }
File name: ClassBLL.cs
Copy
244 public string TinhDiemTB(string MaSV)
245 {
246 SqlConnection con = da.GetConnect();
247 con.Open();
248 //view tc
249 string sql1 = " select 'sotinchi'=sum(SoTC) " +
250 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
251 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD and MaSV='" + MaSV + "'" +
252 " group by MaSV ";
253 SqlCommand cmd1 = new SqlCommand(sql1, con);
254 string tc = cmd1.ExecuteScalar().ToString();
255 // view diem10
256 string sql2 = " select 'cuoiky'=sum(DiemTk10*SoTC) " +
257 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
258 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='" + MaSV + "'" +
259 " group by MaSV ";
260 SqlCommand cmd2 = new SqlCommand(sql2, con);
261 string diem10 = cmd2.ExecuteScalar().ToString();
262 //view diem4
263 string sql3 = " select 'cuoiky'=sum(DiemTk4*SoTC) " +
264 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
265 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='" + MaSV + "'" +
266 " group by MaSV ";
267 SqlCommand cmd3 = new SqlCommand(sql3, con);
268 string diem4 = cmd3.ExecuteScalar().ToString();
269
270
271 string ketqua = "";
272 ketqua = Convert.ToDouble(diem10) / Convert.ToDouble(tc) + "," + Convert.ToDouble(diem4) / Convert.ToDouble(tc);
273 return ketqua;
274 }
File name: crBaoCao.cs
Copy
53 public CrystalDecisions.CrystalReports.Engine.Section Section1 {
54 get {
55 return this.ReportDefinition.Sections[0];
56 }
57 }
File name: crBaoCao.cs
Copy
61 public CrystalDecisions.CrystalReports.Engine.Section Section2 {
62 get {
63 return this.ReportDefinition.Sections[1];
64 }
65 }
File name: crBaoCao.cs
Copy
69 public CrystalDecisions.CrystalReports.Engine.Section Section3 {
70 get {
71 return this.ReportDefinition.Sections[2];
72 }
73 }
File name: crBaoCao.cs
Copy
77 public CrystalDecisions.CrystalReports.Engine.Section Section4 {
78 get {
79 return this.ReportDefinition.Sections[3];
80 }
81 }
File name: crBaoCao.cs
Copy
85 public CrystalDecisions.CrystalReports.Engine.Section Section5 {
86 get {
87 return this.ReportDefinition.Sections[4];
88 }
89 }
File name: crBaoCao.cs
Copy
93 public CrystalDecisions.Shared.IParameterField Parameter_txtMaLop {
94 get {
95 return this.DataDefinition.ParameterFields[0];
96 }
97 }
Download file with original file name:Hi
Hi 142 lượt xem
Gõ tìm kiếm nhanh...