Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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
 

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 15-Jan-13 4:55am
Edited 15-Jan-13 5:03am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

add two lines before refreshing...
 
cryRpt.setdatasource=dr
crystalreportviewer1.reportsource=cryRpt
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 235
1 Sergey Alexandrovich Kryukov 144
2 Rob Philpott 100
3 Peter Leow 70
4 CHill60 70
0 OriginalGriff 6,902
1 Sergey Alexandrovich Kryukov 5,623
2 Maciej Los 3,479
3 Peter Leow 3,373
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100