hi, i making a program that needs crystal report but there is a problem it's not showing the correct report. and i posted the prolem but i didn't get the solution if there is someone who want's to help me
vb.net 2005 SQL 2005
tanks
Printable View
hi, i making a program that needs crystal report but there is a problem it's not showing the correct report. and i posted the prolem but i didn't get the solution if there is someone who want's to help me
vb.net 2005 SQL 2005
tanks
Please describe the problem where you are getting the problem , and related to the crystal related problem there is the crystal report help at my signature for there you are able to learn easily how to call them in the projectQuote:
Originally Posted by met0555
well, in ur signature the code is for vb6 and before, i'm using vb.nt 2005 and SQL 2005. i will retry to explain my problem. i connected th database with the program and theni tried to make a cryst report using the report tool, then i located the database that is connected to my database , t then in the report i can only this the white paper.
Check this code for the VB.NET change the connection and the table and the report name according to your conditionQuote:
Originally Posted by met0555
VB Code:
Dim CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer = New CrystalDecisions.Windows.Forms.CrystalReportViewer Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument CrystalReportViewer1.ActiveViewIndex = 0 CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle CrystalReportViewer1.DisplayGroupTree = False CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill CrystalReportViewer1.Location = New System.Drawing.Point(0, 0) CrystalReportViewer1.Name = "CrystalReportViewer1" Dim querystring As String = "select * from tablename" Dim connection As New OleDbConnection(funcs.con) connection.Open() Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter(querystring, connection) Dim ds As DataSet = New DataSet() Adapter.Fill(ds) Dim dt As DataTable = New DataTable dt = ds.Tables(0) rpt.Load(Application.StartupPath & "/reportname.rpt") rpt.SetDataSource(dt) CrystalReportViewer1.ReportSource = rpt
I have edited your post and removed your email address.
You should never post your email address in an open post on an open forum. Mail spam bots can pick that up and before you know it, your mailbox is full of junk mail. If you wish to share your email address with other forum members, please do so via our PM system.
In addition, we prefer all answers to questions be publically posted rather than sent via EMail or PM. That way, everyone with a similar problem can benefit.
Thanks. :)
Here is some code that might help. You have to have the CrystalReportViewer on your form. This goes in the code of the class. When you drag the subreport onto the report you'll have to fill in the object name within the format tab of the subreport. I recommend you do your report and subreport work within the VS environment.
Dim subreportname1 As String
Dim subreportobject1 As SubreportObject
Dim subreport1 As New ReportDocument
DataSetRptDocketBase1.Clear()
SqlRptDocketBase.Fill(DataSetRptDocketBase1)
DataSetRptSubDocketDetail1.Clear()
SqlRptSubDocketDetail.Fill(DataSetRptSubDocketDetail1)
Dim myreport As RptDocketsShort = New RptDocketsShort
subreportobject1 = myreport.ReportDefinition.ReportObjects.Item("ObjRptSubDocketDetail")
‘ This object name is for the subreport on the main report, format object option
subreportname1 = subreportobject1.SubreportName
subreport1 = myreport.OpenSubreport(subreportname1)
subreport1.SetDataSource(DataSetRptSubDocketDetail1)
myreport.SetDataSource(DataSetRptDocketBase1)
CrystalReportViewer1.ReportSource = myreport