Coding for connection and data binding (1 Viewer)

Ryobi

Registered User.
Local time
Today, 02:13
Joined
Mar 5, 2012
Messages
49
Hello,


I am using Vb.net 2017. I have created a crystal report and connected an msaccess database to the report and have added fields using the connection on the crystal report. I would like to code the connection my self since the I want the database to place in different place in case I want to put in different folders.
The problem that I have is where do I put the code. I do not see any where on the crystal report form where I can place the code. Any ideas or suggestions are welcome.


Thank
 

Ryobi

Registered User.
Local time
Today, 02:13
Joined
Mar 5, 2012
Messages
49
In case somebody is wondering how is done the code is shown below:

Dim cr As New CrystalReport1
cr.Load(strReportPath)
cr.SetDataSource(ds.Tables("Mytable"))

CrystalReportViewer1.ReportSource = cr

CrystalReportViewer1.Refresh()


Place above code at the load event of the Crystal Report Viewer Form.


Note: The code for loading and extracting data from the database is not shown,
but a connection to the database must be made in order to load the data into the ds.table
other wise you will get an an error because ds.Table is not defined.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom