Click here to Skip to main content
15,895,962 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to use an updated datasource to be use in my crystal report. The crystal report datasource is vwMyView. I want to amend the contents of vwMyView and use the updated datasource to be used in the crystal report. How can I do this and what would the syntax be or is there a better way of doing this. Below is my code, what should I add. Help


VB
Public sub PossibleEmployeeSalary

        Dim adoCmd As New SqlClient.SqlCommand
        Dim adoRdr As SqlDataReader
        Dim cryRpt As New ReportDocument

        cryRpt.Load("C:\TEMP\REPORT1.RPT")
        Try
            adoCmd.Connection = adoConn
            adoCmd.CommandType = CommandType.Text
            adoCmd.CommandText = "SELECT * FROM vwMyView"       
            adoCmd.ExecuteReader()

            While adoRdr.Read()
                adoRdr("Salary")  =  adoRdr("Salary")   * 0.05
                adoRdr("Surname") =  adoRdr("Surname")
            End While

            CrystalReportViewer1.Zoom(1)
            CrystalReportViewer1.Refresh()

        Catch ex As Exception

        End Try

    End Sub
Posted
Updated 15-Jan-13 5:03am
v2

1 solution

add two lines before refreshing...

VB
cryRpt.setdatasource=dr
crystalreportviewer1.reportsource=cryRpt
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900