VB.NET - How do I pass data manipulated in VB to a Crystal Report

Asked By C on 11-Jan-13 11:38 AM

I am running a vb program that from a view will produce a list of records. I want these records displayed ont a Crystal Report.

How is this done as my crystal report will not be connected to anything?

Here is an example of a query I want the data onto a crystal report

adoCmd.Connection = adoConnection
adoCmd.CommandType = CommandType.Text
adoCmd.CommandText = "SELECT * FROM viewOfNames where department = "Accounts""
adoRdr = adoCmd.ExecuteReader()

While adoRdr.Read()
    sTest = adoRdr(Surname)
    sTest2 = adoRdr(Forename)
    sTest3 = adoRdr(Department)
End While

The connection is where the view is. I could just use the view but I will be doing all sorts of data manipulation before putting the final results onto crystal reports.

Many thanks in advance

Danasegarane Arunachalam replied to C on 11-Jan-13 09:08 PM
I am not getting what you mean by the view here. Any way try the below source code. It shows how to pass the data from vb to crystal report

http://www.vbcode.com/asp/showsn.asp?theID=11734
Tom Wilson replied to C on 12-Jan-13 10:03 AM
Instead of using a datareader, use a datatable.  Manipulate the data in the datatable and pass the datatable to Crystal Reports.  You can use the datatable's WriteXMLSchema method to create a xml file of the datatable's schema, and use the database expert in Crystal Report to import the xml file into CR.  Then use the report document's SetDataSource property to pass the datatable.
C replied to Danasegarane Arunachalam on 14-Jan-13 10:54 AM
Hi,

Thanks for getting back. Sorry for the delay.
What I meant was create a dataset of data and this dataset to be used in Crystal Reports. The results from the dataset to be used in the crystal reports.




Danasegarane Arunachalam replied to C on 14-Jan-13 08:26 PM
Dataset?. Are you using VB.NET ?
C replied to Danasegarane Arunachalam on 15-Jan-13 10:05 AM
Yes