Last post Feb 23, 2011 07:28 AM by svibuk
Feb 23, 2011 07:28 AM|svibuk|LINK
Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
.ServerName = ConfigurationManager.AppSettings("ServerName") 'YOUR SERVER NAME"
.DatabaseName = ConfigurationManager.AppSettings("MainData") 'YOUR DATABASE NAME"
.UserID = ConfigurationManager.AppSettings("User_ID") 'YOUR DATABASE USERNAME"
.Password = ConfigurationManager.AppSettings("Password") 'YOUR DATABASE PASSWORD"
Dim ReportName As String = "cons.rpt"
ReportName = Application.StartupPath & "\" & ReportName & ""
Dim ReportForm As CrystalDecisions.CrystalReports.Engine.ReportDocument = New
CrTables = ReportForm.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrystalReportViewer1.ReportSource = ReportForm
my sceanrio is in this way
i have a total of 6 reports of which 5 are generated with data directly from the tables
so this 5 reports links i have given to the main mdi form
on which i have as
dim firstreport as new frmone
1)i have taken a form with crystal reportviewer in it
2) designed the crystal report seperately from the drag drop of fields frm the table at design time (one.rpt)
3) set the reportsource of crystalviewer to one.rpt
4) in the code window of the form conatining crystalviewer i have added the above code
for the 6th report which is genereated based on the record selection of the form i have taken dataset & populated it with the record as "select * from table1 where name= '" & drpdwnname.selectedvalue.text & "'"
& on this form on a button click i need to dislay the report
how do i design at run time?
and one mor ethig i have put all the reports in a folder REPORTS
but it was not accepting . so i have copied all that reports in BIN folder
so the report is taken frm bin folder. is there any way that it taken from report folder only