
نوشته شده توسط
mpmsoft
دوستان من فکر می کنم راه بهتر این باشه که DataSource رو پاس بدیم به گزارش ، نه اینکه مسیر پایگاه رو بدیم به کریستال و بگیم اون برامون عمل فیلترینگ رو انجام بده
ما فقط نتیجه رو پاس می دیم به کریستال
سلام ...
منم موافقم ... برای اینکه فقط مسیر رو پاس بدین بایستی توی available datasource از قسمت database Expert گزینه ole db رو انتخاب کنید و دیتابیس رو به اون معرفی کنید ... دیگه نیازی به مسیر دادن نیست فقط کافیه اسم دیتابیس رو بنویسید ... اینجوری
تصاویرو به ترتیب نگاه کنید ...





بعد این دستورات رو در فرم لودتون که قراره گزارش درون اون نمایش داده بشه بنویسید البته یه crystalreportview روی فرم بزارید ...
Dim strConnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=DBTaxitellFile.accdb"
Dim Connection As New OleDbConnection(strConnection)
Dim strSQL As String = "Select * From drivers where ID='" & textbox1.text & "'"
Dim DA As New OleDbDataAdapter(strSQL, Connection)
Dim DS As New DataSet
'Variable to assign the report name
Dim strReportName As String
DA.Fill(DS)
'Pass the reportname to string variable
strReportName = "CardReport"
'Get the Report Location
Dim strReportPath As String = Application.StartupPath & "\" & strReportName & ".rpt"
'Check file exists
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If
'Assign the datasource and set the properties for Report viewer
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
rptDocument.Load(strReportPath)
rptDocument.SetDataSource(DS.Tables(0))
rptViewer.ShowRefreshButton = False
rptViewer.ShowCloseButton = False
rptViewer.ShowGroupTreeButton = False
rptViewer.ReportSource = rptDocument
اگر مشکلی داشتین در خدمتم ...
موفق باشید ...