Click here to Skip to main content
15,798,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
R/All,

Am Using Crystal report in my asp.net 2008 project in vb language.the report are map on run time one time report are showing correct data but when m click export button on crystal report, report are refresh and they are showing all table data instead of our query.

please help us.

I'm Using this code
-----------
VB
Dim rptDoc As New ReportDocument 
Dim dt As New DataTable 
Dim rstRep As New ADODB.Recordset 
st = ConfigurationManager.ConnectionStrings("XXSCL_WebPortelConnectionString").ToString 
con = New Data.SqlClient.SqlConnection(st) 
Dim objRpt As New CrystalReport1 
con.Open() 
Dim dscmd As New SqlDataAdapter(sql, con) 
Dim ds As New DataSet1 
dscmd.Fill(ds, "XXSCL_DDR") 
objRpt.Database.Tables.Item("XXSCL_DDR").SetDataSource(ds) 
CrystalReportViewer1.ReportSource = objRpt


regards
ashish
Posted
Updated 10-May-11 10:16am
v2
Comments
Pong D. Panda 10-May-11 2:52am    
Can you at least show us your code on export? How do you perform your data binding?
Ashish661982 10-May-11 2:54am    
R/All,

m Using this code
-----------
Dim rptDoc As New ReportDocument
Dim dt As New DataTable
Dim rstRep As New ADODB.Recordset
'###########
st = ConfigurationManager.ConnectionStrings("XXSCL_WebPortelConnectionString").ToString
con = New Data.SqlClient.SqlConnection(st)
Dim objRpt As New CrystalReport1
con.Open()
Dim dscmd As New SqlDataAdapter(sql, con)
Dim ds As New DataSet1
dscmd.Fill(ds, "XXSCL_DDR")
objRpt.Database.Tables.Item("XXSCL_DDR").SetDataSource(ds)
CrystalReportViewer1.ReportSource = objRpt
------------

VB
Dim mypdffile As New DiskFileDestinationOptions
mypdffile.DiskFileName = Filename
               With objReport.ExportOptions
                   .ExportDestinationType = ExportDestinationType.DiskFile
                   .DestinationOptions = mypdffile
                   .ExportFormatType = ExportFormatType.PortableDocFormat
               End With

               objReport.Export()
 
Share this answer
 
v2
i think the problem is in this line.

VB
objRpt.Database.Tables.Item("XXSCL_DDR").SetDataSource(ds)


try in this way.

VB
da.Fill(dt)
ds.Tables(0).Merge(dt)
objRpt.SetDataSource(ds)
 
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