using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using CrystalDecisions.CrystalReports.Engine; using System.Data.SqlClient; public class frmReport { private void btnReport_Click(System.Object sender, System.EventArgs e) { SqlConnection objConn = new SqlConnection(); SqlCommand objCmd = new SqlCommand(); SqlDataAdapter dtAdapter = new SqlDataAdapter(); DataSet ds = new DataSet(); DataTable dt = null; string strConnString = null; string strSQL = null; strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"; strSQL = "SELECT * FROM audit WHERE CustomerID = '" + this.txtCustomerID.Text + "' "; objConn.ConnectionString = strConnString; var _with1 = objCmd; _with1.Connection = objConn; _with1.CommandText = strSQL; _with1.CommandType = CommandType.Text; dtAdapter.SelectCommand = objCmd; dtAdapter.Fill(ds, "myDataTable"); dt = ds.Tables[0]; dtAdapter = null; objConn.Close(); objConn = null; ReportDocument rpt = new ReportDocument(); string directory = My.Application.Info.DirectoryPath; //rpt.Load(directory & "\\myCrystalReport1.rpt") rpt.Load("C:\\DemoCrystalReport2\\DemoCrystalReport2\\myCrystalReport1.rpt"); rpt.SetDataSource(dt); this.CrystalReportViewer1.ReportSource = rpt; this.CrystalReportViewer1.Refresh(); } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง