How to create the cyrstal report for given input text file in VB.NET(Urgent)

Posted on 2004-11-30
Last Modified: 2010-04-23
I want to create the crystal report for a text file....
But don't want to use the ODBC....
If i use the Access/Excel(DAO) then it asks for the server name,Login ID,database etc which is not applicable for the text file which i want to get converted into the crystal report...
I am not getting how to create the crystal report for a given text file....
Also how to disable the print & export options of the crystal report????

Waiting eagerly for positive response...


Question by:TPink
    LVL 27

    Accepted Solution

    You have to use a ADO connection...

    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.ReportSource
    Imports CrystalDecisions.Shared
    Imports ADODB                                 '<---- Access
    Imports System.Data.SqlClient            '<---- SQL

        Public myReport As New ReportDocument        'Gobal Report Doc
        Public sAppPath = Application.StartupPath        'Application Directory Main Path
        Public sReportPath = "\Reports\"                     'Reports Directory Path

       '**** Server Connection Vars *********
        Public sDBServer As String = "MYSERVER"
        Public sUSERid As String = "MYUSER"
        Public sDBName As String = "MYDATABASE"
        Public sDBPass As String = ""
        Public Con As OleDb.OleDbConnection      '<--- for Access
        Public Connect As SqlConnection             '<--- for msSQL
        Public sSQL As String

        Private Sub GetReportConnection(ByVal myReport)
            ' Objects used to set the proper database connection information
            Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
            Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

                ' Load the report
                myReport.Load(sAppPath & sReportPath & sReportName, CrystalDecisions.[Shared].OpenReportMethod.OpenReportByTempCopy)
                ' Set the connection information for all the tables used in the report
                For Each tbCurrent In myReport.Database.Tables
                    tliCurrent = tbCurrent.LogOnInfo
                    With tliCurrent.ConnectionInfo
                        .ServerName = sDBServer
                        .UserID = sUSERid
                        .Password = ""
                        .DatabaseName = sDBName
                    End With
                Next tbCurrent
            Catch Exp As LoadSaveReportException
                MsgBox("Incorrect path for loading report.", _
                        MsgBoxStyle.Critical, "Load Report Error")
            Catch Exp As Exception
                MsgBox(Exp.Message & "   in GetReportConnection Procedure", MsgBoxStyle.Critical, "General Error")
            End Try
        End Sub

    LVL 100

    Assisted Solution

    To completely disable printing and exporting
    Open the report
    Click the NO PRINTER option.  Report cannot be printed until this is turned off

    Don't load any of the Export dlls on the client machine

    How do you plan to display the report?  Is it from a viewer or the Crystal designer?
    What version of Crystal?  Which edition?


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now