Export crystal report to PDF

 Hi everyone,

I'm kind of new in ASP.NET and i have this project where i have to convert a gridview into a PDF file, but this was getting very difficult so i decided to use a crystal report instead.

Which now leads me to a an other question.

In my page i can use the (drag and drop) CrytalreportViewer and then export to PDF, but i was thinking of something different.

What i wanted to do was still had the gridview but add just below a "Export to PDF" button, that would export the content of the gridview (which is the same of the crystalreport) to PDF. 

What i mean is when the user presses the button it would export the crystal report to PDF.

Like i haven't got to much experience, i googled to find out how to do this and for a week or so i've been trying to get the code above to work but with no success.

I've tried to get help in this forum, but all people do is recommend to read articles, that most of them i've read, and all the code that i've found always gives me an error.

 

So if someone could help with the error of this code or just indicate me a code that is really working i would really appreciate. 



   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        Dim myReport As CrystalReport1 = New CrystalReport1()  --> it says : Type CrystalReport1 is not defined.
        'Note : we are creating an instance of the strongly-typed Crystal Report file here.
 
        Dim DiskOpts As CrystalDecisions.Shared.DiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
        myReport.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
        ' You also have the option to export the report to other sources
        ' like Microsoft Exchange, MAPI, etc.       
 
        myReport.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
        'Here we are exporting the report to a .pdf format.  You can
        ' also choose any of the other formats specified above.
 
        DiskOpts.DiskFileName = "c:\Output.pdf"
        'If you do not specify the exact path here (i.e. including
        ' the drive and Directory),
        'then you would find your output file landing up in the
        'c:\WinNT\System32 directory - atleast in case of a
        ' Windows 2000 System
        myReport.ExportOptions.DestinationOptions = DiskOpts
        'The Reports Export Options does not have a filename property
        'that can be directly set. Instead, you will have to use
        'the DiskFileDestinationOptions object and set its DiskFileName
        'property to the file name (including the path) of your  choice.
        'Then you would set the Report Export Options
        'DestinationOptions property to point to the
        'DiskFileDestinationOption object.
 
        myReport.Export()
        'This statement exports the report based on the previously set properties.
 
    End Sub

 

Thanks in advance.

Nuno 

0
wop_nuno
6/9/2008 10:11:30 AM
asp.net.crystal-reports 7043 articles. 0 followers. Follow

16 Replies
2829 Views

Similar Articles

[PageSpeed] 57

Try the Following code

First create crystal report.In the interface of report i.e
aspx form to display report,add report document as
Toolbox-->Components-->ReportDocument.
Call the sub routine CreatePDF to display report.
rptProduct is the name of crystal report and docProd is the
name of report document.



								
Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO

'This call is required by the Web Form Designer.
     Private Sub InitializeComponent()
        'start - This code should be pasted under #Region
Private Sub itializeComponent()
'rptProduct is the name of crystal report.
        Me.docProd = New rptProduct
        '
        'docProd
        '
        Me.docProd.PrintOptions.PaperOrientation =
CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation
        Me.docProd.PrintOptions.PaperSize =
CrystalDecisions.Shared.PaperSize.DefaultPaperSize
        Me.docProd.PrintOptions.PaperSource =
CrystalDecisions.Shared.PaperSource.Upper
        Me.docProd.PrintOptions.PrinterDuplex =
CrystalDecisions.Shared.PrinterDuplex.Default
'Ends here
    
'Declaration of report document
Protected WithEvents docProd As rptProduct

Private Sub CreatePDF()        
        Dim objDS As New DataSet
        Dim dfdoFile As New
CrystalDecisions.Shared.DiskFileDestinationOptions
        Dim strServerPath As String
        Dim szFileName As String

       
            'Create dataset as per requirement

            docProd.SetDataSource(objDS.Tables(0))

            szFileName = Session.SessionID & ".pdf"        
' rptDailyCalls.pdf
            strServerPath = MapPath("~") & "\Report\"      
' Here the pdf file will be saved.   
                     File.Delete(strServerPath & "\" &
szFileName)   ' Delete file first
            dfdoFile.DiskFileName = strServerPath & "\" &
szFileName
            With docProd
                .ExportOptions.ExportDestinationType =
CrystalDecisions.Shared.ExportDestinationType.DiskFile
                .ExportOptions.ExportFormatType =
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
                .ExportOptions.DestinationOptions = dfdoFile
                .Export()
            End With
       'URL of the pdf file
 Response.Redirect("http://localhost/WebApplication1/" &
szFileName ,Flase)
End Sub

From:
Himanshu Hajariwala
For More Helps Visit : http://himanshu-hajariwala.blogspot.com/
IF IT HELPS YOU THEN KINDLY PRESS THE "ANSWER" BUTTON.
0
himanshu_hajariwala
6/9/2008 11:18:12 AM

http://vb.net-informations.com/crystal-report/vb.net_crystal_reports_tutorials.htm 

check the above link, anyways i would like to give you my codes also check below

Imports System.Web.UI

Imports System.Data.SqlClient

Imports CrystalDecisions.Shared

Imports CrystalDecisions.CrystalReports.Engine  (hope you pulled out the crystal report viewr control to web form)

 '--------------------------------------------------------------------------------------------------------------------------

Partial Class FinancialStatement

Inherits System.Web.UI.Page

                     Dim rpt As New ReportDocument

'------------------------------------------------------------------------------------ 

'Following is the code for providing log on parameter to the report

Private Sub configureCrystalReports()

Dim myconnectioninfo As ConnectionInfo = New ConnectionInfo()

myconnectioninfo.DatabaseName = "Your Server Name"

myconnectioninfo.UserID = "sa"

myconnectioninfo.Password = "Your Password"

SetDBLogOnForReport(myconnectioninfo)

End Sub

Private Sub SetDBLogOnForReport(ByVal myConnectionInfo As ConnectionInfo)

Dim myTableLogonInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo

For Each myTabeLogoninfo As TableLogOnInfo In myTableLogonInfos

myTabeLogoninfo.ConnectionInfo = myconnectioninfo

Next

End Sub

'----------------------------------------------------------------------------------------------

'Button Click Event

printNotes()    ' function to generate report, definition follows

rpt.SetParameterValue("Curr", cur_year)      'only if you have parameter in report 'curr' is the name of the parameter in the report, cur_year is the variable name which give value

configureCrystalReports()

rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("~/Export/NotesToTheFinancialStatement.pdf"))   'this will export yoour report to pdf

'-----------------------------------------------------------------------------------------------------------------------

Private Sub printNotes()

rptParameter = "NOTES TO THE FINANCIAL STATEMENTS"

cur_year = txt_year.Text

prv_year = Val(cur_year) - 1

Dim thisConnectionString As String = ConfigurationManager.ConnectionStrings("YourConnectionString").ConnectionString 'conection string name from web.config

Dim myConn As SqlConnection = New SqlConnection(thisConnectionString)

Dim MyCommand As New SqlCommand()

MyCommand.Connection = myConn

MyCommand.CommandText = "USP_FinancialBudget '" & cur_year & "','" & rptParameter & "'" 'this is a stored procedure which i am using to retrieve data, u can use your query here

MyCommand.CommandType = Data.CommandType.Text

Dim myDa As New SqlDataAdapter

myDa.SelectCommand = MyCommand

Dim myDS As New DS()

myDa.Fill(myDS, "USP_FinancialBudget")

rpt.Load(Server.MapPath("rpNotes.rpt"))

rpt.SetDataSource(myDS)

rpt.PrintOptions.PaperOrientation = PaperOrientation.Portrait

Me.CrystalReportViewer1.ReportSource = rpt

End Sub

 

'-----------------------------------------------------------------------------------------------

thats all, you have to add a dataset, i named my dataset as DS,

change the crystal report viewer's visibilty to false

and carefull with the queries.....

 

0
joseabie
6/9/2008 11:26:52 AM

 Hi joseabie,

I did what you did but i'm getting lot's of errors. 

 For this line i get this error: Dim rpt As New ReportDocument -->  Error    6    'ReportDocument' is ambiguous in the namespace 'CrystalDecisions.CrystalReports.Engine'.   


Why is this?

0
wop_nuno
6/9/2008 12:00:06 PM

did u drag the crystal report viwer in to your web page?????

0
joseabie
6/9/2008 12:07:55 PM

Hi himanshu

I didn't quiet understand somethings you said, but here is my code:

Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO
Partial Class Default3
    Inherits System.Web.UI.Page
    Private Sub InitializeComponent()

        'Declaration of report document
        Dim docProd As rptProduct


    End Sub
    Private Sub intializeComponent()
        'rptProduct is the name of crystal report.
        Me.docProd = New rptProduct
        '
        'docProd
        '
        Me.docProd.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation()
        Me.docProd.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize()
        Me.docProd.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Upper()
        Me.docProd.PrintOptions.PrinterDuplex = CrystalDecisions.Shared.PrinterDuplex.Default()
        'Ends here
    End Sub
    Private Sub CreatePDF()
        Dim objDS As New DataSet
        Dim dfdoFile As New CrystalDecisions.Shared.DiskFileDestinationOptions()
        Dim strServerPath As String
        Dim szFileName As String


        'Create dataset as per requirement

        docProd.SetDataSource(objDS.Tables(0))

        szFileName = Session.SessionID & ".pdf"
        ' rptDailyCalls.pdf
        strServerPath = MapPath("~") & "\Report\"
        ' Here the pdf file will be saved.  
        File.Delete(strServerPath & "\" & szFileName)   ' Delete file first
        dfdoFile.DiskFileName = strServerPath & "\" & szFileName()
        With docProd
            .ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile()
            .ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat()
            .ExportOptions.DestinationOptions = dfdoFile
            .Export()
        End With
        'URL of the pdf file
        Response.Redirect("http://localhost/WebApplication1/" & szFileName, Flase)
    End Sub

End Class

 

bu ti get all this errors:

 

Error    6    'ReportDocument' is ambiguous in the namespace 'CrystalDecisions.CrystalReports.Engine'.   
Error    7    'ExportFormatType' is ambiguous in the namespace 'CrystalDecisions.Shared'.  
Error    8    Type 'rptProduct' is not defined.  
Error    9    'docProd' is not a member of 'Default3'.   
Error    10    Type 'rptProduct' is not defined.   
Error    11    'docProd' is not a member of 'Default3'.  
Error    12    'PaperOrientation' is ambiguous in the namespace 'CrystalDecisions.Shared'.   
Error    13    'docProd' is not a member of 'Default3'.  
Error    14    'PaperSize' is ambiguous in the namespace 'CrystalDecisions.Shared'.   
Error    15    'docProd' is not a member of 'Default3'.   
Error    16    'PaperSource' is ambiguous in the namespace 'CrystalDecisions.Shared'.   
Error    17    'docProd' is not a member of 'Default3'.   
Error    18    'PrinterDuplex' is ambiguous in the namespace 'CrystalDecisions.Shared'.  
Error    19    'DiskFileDestinationOptions' is ambiguous in the namespace 'CrystalDecisions.Shared'.    C
Error    20    Name 'docProd' is not declared.  
Error    21    Argument not specified for parameter 'index' of 'Public ReadOnly Default Property Chars(index As Integer) As Char'.   
Error    22    Name 'docProd' is not declared.  
Error    23    'ExportDestinationType' is ambiguous in the namespace 'CrystalDecisions.Shared'.  
Error    24    'ExportFormatType' is ambiguous in the namespace 'CrystalDecisions.Shared'.   
Error    25    Name 'Flase' is not declared.  
0
wop_nuno
6/9/2008 12:10:19 PM

 Hi Joseabie,

What i did was drag and drop the crystal report viewer and associate it to my report.

<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
            Height="1119px" ReportSourceID="CrystalReportSource1" Width="875px" />
        <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="CrystalReport2.rpt"></Report>
</CR:CrystalReportSource>
   
    </div>
    </form>
</body>

My code is:

 

Imports System.Web.UI

Imports System.Data.SqlClient

Imports CrystalDecisions.Shared

Imports CrystalDecisions.CrystalReports.Engine
Partial Class Default3
    Inherits System.Web.UI.Page

    Dim rpt As New ReportDocument

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        printNotes()    ' function to generate report, definition follows

        rpt.SetParameterValue("Curr", cur_year)      'only if you have parameter in report 'curr' is the name of the parameter in the report, cur_year is the variable name which give value
        configureCrystalReports()

        rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("~/Export/NotesToTheFinancialStatement.pdf"))   'this will export yoour report to pdf

    End Sub

    Private Sub printNotes()

        rptParameter = "NOTES TO THE FINANCIAL STATEMENTS"

        cur_year = txt_year.Text

        prv_year = Val(cur_year) - 1
        Dim thisConnectionString As String = ConfigurationManager.ConnectionStrings("YourConnectionString").ConnectionString 'conection string name from web.config

        Dim myConn As SqlConnection = New SqlConnection(thisConnectionString)
        Dim MyCommand As New SqlCommand()

        MyCommand.Connection = myConn

        MyCommand.CommandText = "USP_FinancialBudget '" & cur_year & "','" & rptParameter & "'" 'this is a stored procedure which i am using to retrieve data, u can use your query here

        MyCommand.CommandType = Data.CommandType.Text
        Dim myDa As New SqlDataAdapter

        myDa.SelectCommand = MyCommand
        Dim myDS As New DataSet1()

        myDa.Fill(myDS, "USP_FinancialBudget")
        rpt.Load(Server.MapPath("rpNotes.rpt"))

        rpt.SetDataSource(myDS)

        rpt.PrintOptions.PaperOrientation = PaperOrientation.Portrait
        Me.CrystalReportViewer1.ReportSource = rpt

    End Sub
End Class

 

 So with this my code i'm getting this errors:

Error    6    'ReportDocument' is ambiguous in the namespace 'CrystalDecisions.CrystalReports.Engine'.   
Error    7    'ExportFormatType' is ambiguous in the namespace 'CrystalDecisions.Shared'.  
Error    8    'ReportDocument' is ambiguous in the namespace 'CrystalDecisions.CrystalReports.Engine'.  
Error    9    Name 'cur_year' is not declared.   
Error    10    Name 'configureCrystalReports' is not declared.  
Error    11    'ExportFormatType' is ambiguous in the namespace 'CrystalDecisions.Shared'.   
Error    12    Name 'rptParameter' is not declared.   
Error    13    Name 'cur_year' is not declared.   
Error    14    Name 'txt_year' is not declared.  
Error    15    Name 'prv_year' is not declared.  
Error    16    Name 'cur_year' is not declared.  
Error    17    Name 'cur_year' is not declared.   
Error    18    Name 'rptParameter' is not declared.   
Error    19    'PaperOrientation' is ambiguous in the namespace 'CrystalDecisions.Shared'.   

has you can see i didn't use  this, because i think it's not necessary:

Private Sub configureCrystalReports()

Dim myconnectioninfo As ConnectionInfo = New ConnectionInfo()

myconnectioninfo.DatabaseName = "Your Server Name"

myconnectioninfo.UserID = "sa"

myconnectioninfo.Password = "Your Password"

SetDBLogOnForReport(myconnectioninfo)

End Sub

Private Sub SetDBLogOnForReport(ByVal myConnectionInfo As ConnectionInfo)

Dim myTableLogonInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo

For Each myTabeLogoninfo As TableLogOnInfo In myTableLogonInfos

myTabeLogoninfo.ConnectionInfo = myconnectioninfo

Next

End Sub

 

 My dataset is called "DataSet1" altought  i don't know if ti's necessary.

0
wop_nuno
6/9/2008 12:22:14 PM

my friend , r u using ASP.Net 2.0 (vb) CR 11???

0
joseabie
6/9/2008 12:26:56 PM

I'm using visual basic 2005 professional.

The framework i think it's v2.0.50727 (it's the folder i have in C:\WINDOWS\Microsoft.NET\Framework; beside this folder i have two more v1.0.3705  and v1.1.4322).

About the crystal reports i don't know? How can i know that?

 

 

0
wop_nuno
6/9/2008 12:30:25 PM

ok let me star again from web.config

I. your connection string

<connectionStrings>

<add name="MyConnectionString" connectionString="Data Source=MyDataSource;Initial Catalog=MyDatabaseName;UserID=sa;Password=password" providerName="System.Data.SqlClient"/>

</connectionStrings>

'-----------------------------------------------------------------------------------------------------------------

II. Now right click on your project name (in the solution explorer window) and click on 'Add New Item'

Select Dataset and name it as 'DS'

add the table adapter, here i am using a stored procedure so i  select 'existing stored procedure' from the wizard

save all

 '-------------------------------------------------------------------------------------------

III. Drag a crystal report viewer from the tool box in to your design page

      III. a)

             <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"

              DisplayGroupTree="False" DisplayPage="False" DisplayToolbar="False" EnableDatabaseLogonPrompt="False"

                EnableParameterPrompt="False" Visible="False" />

IV. right click on the project name -> add new item -> crystal reports

     IV. a) Select blank report

    IV. b) open the field explorer -> right click on database fields -> Database experts -> Project Data -> expand the ADO.net objects -> expand DS -> u can see our stored procedure name -> select it and click on '>' button -> ok

   IV. c) open the field explorer in the report -> expand the stored procedure name -> drag and drop the fields

'------------------------------------------------------------------------------------------------------------------------------

coding ,

'importing name spaces

Imports System.Web.UI

Imports System.Data.SqlClient

Imports CrystalDecisions.Shared

Imports CrystalDecisions.CrystalReports.Engine

 '-----------------------------------------------------------------------------

'Declaring the object of crystal report

Partial Class Default3

Inherits System.Web.UI.Page

                 Dim rpt As New ReportDocument

 

' giving log on parameters to report

Private Sub configureCrystalReports() Dim myconnectioninfo As ConnectionInfo = New ConnectionInfo()

myconnectioninfo.DatabaseName = "MyDataSource"  'change it with your datasorce name

myconnectioninfo.UserID = "sa"

myconnectioninfo.Password = "password"

SetDBLogOnForReport(myconnectioninfo)

End Sub

Private Sub SetDBLogOnForReport(ByVal myConnectionInfo As ConnectionInfo)

Dim myTableLogonInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo

For Each myTabeLogoninfo As TableLogOnInfo In myTableLogonInfos

myTabeLogoninfo.ConnectionInfo = myconnectioninfo

Next

End Sub

the above 2 functions will give log on parameter to reports

'--------------------------------------------------------------------------------------------

'On Button cick code

        Dim thisConnectionString As String = ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString
        Dim myConn As SqlConnection = New SqlConnection(thisConnectionString)
        Dim MyCommand As New SqlCommand()
        MyCommand.Connection = myConn
        MyCommand.CommandText = "USP_FinancialBudget" ' this is the stored procedure which i added to data set
        MyCommand.CommandType = Data.CommandType.Text
        Dim myDa As New SqlDataAdapter
        myDa.SelectCommand = MyCommand
        Dim myDS As New DS()
        myDa.Fill(myDS, "USP_FinancialBudget")
        rpt.Load(Server.MapPath("reportName.rpt"))
        rpt.SetDataSource(myDS)
        rpt.PrintOptions.PaperOrientation = PaperOrientation.Portrait
        Me.CrystalReportViewer1.ReportSource = rpt
        configureCrystalReports()
        rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("~/Export/NotesToTheFinancialStatement.pdf"))

'the last line will export this rpt to pdf in the folder called 'Export' in the server where the web is published

to pop up the pdf when a button clicked

Dim popupscript As String = "<script language='javascript'>" + "window.open('Export/NotesToTheFinancialStatement.pdf');</script>"

Page.ClientScript.RegisterStartupScript(Me.GetType(), "PopUpWindow", popupscript, False)

'the second last line a small javascript option to pop the pdf file in a new window

'-------------------------------------------------------------------------------------------------------------------------------------------------------------

my friend this is how i am working and is successfull in different client side..

0
joseabie
6/9/2008 1:25:42 PM

 Hi Joseabi,

Here is my code :

Imports System.Web.UI

Imports System.Data.SqlClient

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Partial Class Default3
    Inherits System.Web.UI.Page


    Dim rpt As New ReportDocument --> 'ReportDocument' is ambiguous in the namespace 'CrystalDecisions.CrystalReports.Engine'. 

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim thisConnectionString As String = ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString
        Dim myConn As SqlConnection = New SqlConnection(thisConnectionString)
        Dim MyCommand As New SqlCommand()
        MyCommand.Connection = myConn
        MyCommand.CommandText = "USP_FinancialBudget" ' this is the stored procedure which i added to data set
        MyCommand.CommandType = Data.CommandType.Text
        Dim myDa As New SqlDataAdapter
        myDa.SelectCommand = MyCommand
        Dim myDS As New DS()
        myDa.Fill(myDS, "USP_FinancialBudget")
        rpt.Load(Server.MapPath("reportName.rpt"))
        rpt.SetDataSource(myDS)
        rpt.PrintOptions.PaperOrientation = PaperOrientation.Portrait  --> 'PaperOrientation' is ambiguous in the namespace 'CrystalDecisions.Shared'. 
        Me.CrystalReportViewer1.ReportSource = rpt
        configureCrystalReports()  --> Name 'configureCrystalReports' is not declared.
        rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("~/Export/NotesToTheFinancialStatement.pdf")) -->ExportFormatType' is ambiguous in the namespace 'CrystalDecisions.Shared'. 

        'the last line will export this rpt to pdf in the folder called 'Export' in the server where the web is published to pop up the pdf when a button clicked

        Dim popupscript As String = "<script language='javascript'>" + "window.open('Export/NotesToTheFinancialStatement.pdf');</script>"

        Page.ClientScript.RegisterStartupScript(Me.GetType(), "PopUpWindow", popupscript, False)

    End Sub
End Class

But i still have 4 errors:

Error    6    'ReportDocument' is ambiguous in the namespace 'CrystalDecisions.CrystalReports.Engine'.  


Error    7    'PaperOrientation' is ambiguous in the namespace 'CrystalDecisions.Shared'.  


Error    8    Name 'configureCrystalReports' is not declared.   


Error    9    'ExportFormatType' is ambiguous in the namespace 'CrystalDecisions.Shared'.   
 

 

My web config

<connectionStrings>
        <add name="VarelaBusLogConnectionString" connectionString="Data Source=VSQL1;Initial Catalog=VarelaBusLog;Integrated Security=True" providerName="System.Data.SqlClient"/>
    </connectionStrings>

 

The only thing i didn't use was this because i'm using integrated security.

 

joseabie:
Private Sub configureCrystalReports() Dim myconnectioninfo As ConnectionInfo = New ConnectionInfo()

myconnectioninfo.DatabaseName = "MyDataSource"  'change it with your datasorce name

myconnectioninfo.UserID = "sa"

myconnectioninfo.Password = "password"

SetDBLogOnForReport(myconnectioninfo)

End Sub

Private Sub SetDBLogOnForReport(ByVal myConnectionInfo As ConnectionInfo)

Dim myTableLogonInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo

For Each myTabeLogoninfo As TableLogOnInfo In myTableLogonInfos

myTabeLogoninfo.ConnectionInfo = myconnectioninfo

Next

End Sub

the above 2 functions will give log on parameter to reports

 


So what i'm i doing wrong? Is it my repor name? My report name is "CrystalReport2.rpt".


 

 

0
wop_nuno
6/9/2008 2:12:04 PM

 Hi Joeabi,

I'm i doing anything wrong?
 

0
wop_nuno
6/9/2008 3:02:24 PM

 Please can anyone help me? this is driving me crazy!!!!!

0
wop_nuno
6/9/2008 3:33:36 PM

 Hi himanshu_hajariwal,

 Do you know why i'm having problems with your code?

Thanks
 

0
wop_nuno
6/9/2008 4:31:21 PM

i believe you have 2 versions of crystal reports installed (not sure)

eror number 8, if you don't want the log on parameter you can delete the configure crystalreport()

also check your web.config,

<add assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>


<add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.ReportSource, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.Enterprise.Framework, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.Enterprise.Desktop.Report, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

'check your web.config with the above...

google your error , so u'll get usefull link also...

0
joseabie
6/10/2008 4:30:10 AM

 Hi Joseabi,

I've already googled my error and i haven't much help.

My web config file looks like this:

assemblies>

   <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

   <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

   <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

   <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

   <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

   <add assembly="CrystalDecisions.ReportSource, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

   <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

   <add assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

   <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

   <add assembly="CrystalDecisions.Enterprise.Framework, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

   <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

   <add assembly="Microsoft.VisualC, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

</assemblies>

Is anything wrong?

 

 

0
wop_nuno
6/10/2008 12:19:35 PM

Hi I have tried these steps.

But i am not able to see the procedurename when i expand field explorer.

I am not getting the portion after adding the dataset.

There we have to select procedure name .

But it shows error like 'it will not take data from your dataset"

In your article,u instructed to select "Existing stored procedure and give save all.

There they are asking for different options.pls check it.

Regards.,

Chit


Chithra_Iyer
0
Chithra_Iyer
6/23/2008 11:02:37 AM
Reply:

Similar Artilces:

Converting Crystal Reports 9 report to Crystal Reports .NET report
I have a web page that is supposed to display a crystal report.  The report is fully written and functional in crystal 9 (non-.Net)  .  Is there a way to convert my .rpt so that I can just include it in the new web site? why you don't try to compile project with .net and include your report. then if crystal report is power tool will suggests you with conversation tool    My blog is here.Please remember to 'Mark as Answer' if this post answered your question! Wow it really was that easy!  I just added the old crystal report into my .NET proj...

crystal reports .net -> crystal reports .net 2003
recently converted a project from .net to .net 2003. The 2 crystal reports I had in the project do not load when executing the application. The project itself within 2003 will allow me to multiplat the crystal reports, however when it comes to execution time I get the error: Invalid Data Source. If this isn't the right forum please point me to the right one as this is really the only website I know of with a large reader base. >to multiplat the crystal reports To what the crystal reports? Do you have the same database connections established and verified in your 2003 s...

Export Crystal Report to Crystal Report format
I looked at some sample code provided by crystaldecisions, and they have the ability to export a web crystal report to a crystal report. I was assuming that this would cause the local instance of Crystal reports on the client machine to be invoked. I tried this in my project, and I get the following error: Error Encountered by Crystal Web Report Server -------------------------------------------------------------------------------- The error message returned is: Connection to Report Server Failed. It creates the file as an .rpt file in the directory it should. Do I need a dif...

Export Crystal report to PDF report
Hello, Does anyone knows how to export the Crystal report (.rpt) to the PDF report in c#?  Thanks  http://www.beansoftware.com/ASP.NET-Tutorials/Export-Crystal-Reports-To-PDF.aspxhttp://visualbasic.ittoolbox.com/groups/technical-functional/visualbasic-l/programmatically-exporting-from-crystal-report-to-pdf-using-vb-1480987http://www.codeproject.com/KB/vb/JatsArticle1.aspx  Don't say thanks rather mark my reply as "Answer" if it helps you ,Doing so u'll get points tooamiT jaiNC#.NET Articles Hi, You can use the following  rptDoc.ExportToHttpRespons...

integration of Crystal Report with .NET ; crystal report viewer not displaying in Toolbox
Hi I m new to Visual Web Developer 2005 Express Edition. I want to integrate Crystal Report with .NET. In my Toolbox , Crystal Report Viewer is not displaying. How to make it possible? + How to call my report from asp.net 2.0. Need source code plz.*Share Knowledge Every TIME Crystal Reports for .NET does not come with VWD Express.  It only comes with VS 2005 Professional (I'm not sure about the Standard edition).If you have Crystal Reports 10 or XI, you can installed the .NET libraries for Crystal and then use them within VWD Express, noting that you have to build your reports ...

VS .net 2005 Crystal reports ok to run on Crystal Reports XI?
I am getting mixed messages from the asp.net website hosting providers - some say they do not support Crystal Reports due to a $25,000 per cpu licensing fee, others say all I need to do is install Crystal Reports XI (about $500) on a dedicated server and it will run fine. Will Reports developed with the embeded Crystal Reports in VS 2005 run in a Crystal Reports XI environment? Thanks....

Cassini, VS.Net and Crystal Reports
Hi,I am working with Win XP home, Cassini and VS.Net.I would like to play with some Crystal Reports.I create the report in VS as CrystalReport1.I put a CrystalReportViewer on my web form. It does not get recognized as a defined object type but there are no build errors.When I run the app I get an error: Type 'CrystalReport1' is not defined.I have googled on this and see several things people have suggested/tried to correct this. Most I have already tried or the suggestions are not very clear to me. Then I came across a msg that instructed me to set up virtual directories for IIS for CrystalR...

How to render pdf directly on crystal report viewer (WHEN crystal report expects user input before rendering)
  If a crystal report do not need any parameter  or, if parameters can be supplied using code-behind (without user help), I am able to render a pdf on crystal report viewer. BUT if a crystal report needs user input then how do I reneder a PDF on crystal report viewer? I see a parameter-asking dialog-box from crystal report where user supplies input values and hit OK button, but then on click of OK button do I have control what gets rendered a crystal report or, a pdf or, doc?  Or, can I set crystal report viewer control property to say that report need to be rend...

Crystal Report.NET: Error occurred when export to PDF
I encountered this error when attempting to export a report to PDF in a Window Form application: System.NotSupportedException: Error in File C:\DOCUME~1\tnguyen1\LOCALS~1\Temp\temp_a605641b-1f63-401d-b8e3-710c095306bd.rpt: Operation not yet implemented. at .A(Int16 , Int32 ) at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export() at WinFormReport.ReportManager.ExportToPdf(ReportDocume...

data truncation problem while Exporting report to PDF using Crystal Reports 11.0
hi, I need a solution for data truncation problem while Exporting report to PDF using Crystal Reports 11.0 version.    ...

Are there other reporting tools other than reporting services and crystal reports
Has anyone had any experience with any reporting tools other than Reporting services and Crystal reports? If so, is there one that you would strongly recommend? Or, are these two the top choice on the market for report generation from .NET? I have heard some moaning and groaning about reporting services. Specifically in regards to the amount of time needed to design a report. Crystal reports seems kind of difficult to me, as I don't have any training with it. Basically I am looking for a reporting tool that is easy to use, and can be used from .NET....

Errors with all my reports after upgrade from Bundeled Crystal.NET (VS2003) to Crystal XI Developer for .NET
All my Crystal reports were developed using the bundled Crystal in VS 2003.  I just installed the Crystal XI for .NET Developer version that we purchased and now I get an error when running my reports.  (I am running them in debug mode on my development machine). I have tested it on several different reports.  I did not change the code, this worked fine in the previous version. First I reference my report (AccountList is the AccountList.rpt report that is in my project): Dim myReport As New AccountList Then I start rolling through the report's tables to update the log...

Crystal Report.NET and nested sub reports
I have a report where i need to have several nested subreports... A parent may have childs and childs may have other childs and so on... CrystalReport.NET and VS2005 seems to support one level of subreport (a report could have a nested subreport but this nested subreport can't have another nested subreport). I really need to handle multiple levels of nested subreports in order to complete my report. What is the solution ???   Thanks   Eviral     I'm not positive if this works but its worth a shot.  Create the subreports as se...

Reporting (Crystal Reports vs. Custom .NET)
Ok, so I have to confess, I have never tried Crystal Reports. I just recently started working for a marketing company now and reporting is VERY important to them.  I am currently migrating a lot of the applications they use from VB5 and VB6 to web based .NET 3.5 apps.   The whole company is running off ACCESS databases if you can believe that.  They sometimes have up to a few hundred agents taking sales on incoming calls and chat sessions and they are all getting streamed to FLAT file records (completely un-normalized database).  I am in the process of developing a c...

How do I incorporate a crystal report other than the crystal report provided by Visual Studio?
I'm working with the CrystalDecision version of the crystal report. How do I incorporate this into my development?...

Web resources about - Export crystal report to PDF - asp.net.crystal-reports

Crystal - Wikipedia, the free encyclopedia
This article is about crystalline solids. For the type of glass, see Lead glass . For other uses, see Crystal (disambiguation) . A crystal or ...

EPL Crystal Palace v Chelsea: Video, highlights, Willian goal
CHAMPIONS Chelsea rediscovered the winning habit with a convincing 3-0 victory at Crystal Palace on Sunday to move away from trouble at the foot ...

Crystal Johns Leaving CBS News
Crystal Johns , director of talent development and diversity at CBS News, is leaving the network and joining Bienstock, the UTA-owned talent ...

5 Crystal Clear Translation Services That Will Boost WordPress Site Conversions
... check before committing to a freelancer. Although uncommon, it’s possible for you to get scammed through the service. The post 5 Crystal Clear ...

Expert: ‘History Won’t Look Kindly’ On Obama’s Foreign Policy, For 3 Crystal Clear Reasons
Expert: ‘History Won’t Look Kindly’ On Obama’s Foreign Policy, For 3 Crystal Clear Reasons

UTA’s Bienstock Division Hires CBS News’ Crystal Johns
Bienstock , the news and broadcast division of talent/literary agency UTA , has hired CBS News executive Crystal Johns as a broadcast news agent. ...

Dele Alli Wondergoal Puts Spurs Up 2-1 On Crystal Palace
Is this the goal of the season? It might be, as Dele Alli scored an absolutely incredible golazo that has us searching for words. Read more... ...

Rise of the Tomb Raider director leaves Crystal Dynamics for Infinity Ward
Tomb Raider Senior Art Director and Rise of the Tomb Raider Game Director Brian Horton has left Crystal Dynamics, the developer announced via ...

Hands-Free Phone Calls And Crystal Clear Music At A Price That's Music To Your Ears
The iClever HIMBOX offers hands-free voice-activated calling as well as aptX audio streaming. A lot of my time is spent reviewing some of the ...

Man Bathes In, Then Tries To Escape Bathtub Filled With 500 Pounds Of Crystal Clear Putty
This is a video from Vat19 of an employee sinking into a bathtub filled with 500 pounds of their Liquid Glass Thinking Putty , then trying to ...

Resources last updated: 1/23/2016 5:53:34 PM