CRystal /vb.net - same output with different data

ilancerose

New member
Joined
Dec 27, 2005
Messages
1
Programming Experience
10+
I have created a .rpt file using the VS.net version of crystal. When I run the vb.net program to display the report in reportviewer, I get the same output even if I change the data. I am trying to use an XML file as input for the report.

Are there any simple sample files that I could use to point me in the right direction?

Any help would be appreciated.

Thanks.
 

komrul_alam

Member
Joined
Feb 20, 2006
Messages
6
Programming Experience
1-3
Let us have an XML file (Student.Xml) like this
<Student>
<Name></Name>
<RollNo></RollNo>
</Student>

U select this file as and drag & drop the fields to the crystal report at design time.

Next Call the following function

Private Sub FillStudentDataTable(
' create a DataTable
Dim dtStudent as DataTable
dtStudent = CreateCANDataTableColumns()

'Create a DataRow
Dim drowStudent As DataRow = dtStudent .NewRow

drowStudent("Name")="Samim"
drowStudent("RollNo")="123"
dtStudent .Rows.Add(drowStudent)
' u can easily use a for loop to add a no of rows to the table

Dim ds as New DataSet
ds.Tables.Add(dtStudent)

CrystalReport1.Database.Tables(0).SetDataSource(ds.Tables(0))
CrystalReportViewer1.ReportSource = CrystalReport1

End sub

Private Function CreateCANDataTableColumns() as DataTable

Dim dt as DataTable

dt = New DataTable("Student")
dt.Columns.Add("Name", GetType(String))
dt.Columns.Add("RollNo", GetType(String))

return dt

End Sub
 
Top Bottom