Results 1 to 3 of 3

Thread: Db Connection to crystal report

  1. #1

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Db Connection to crystal report

    Hi, I am using VS2008 and crystal reports that came shipped with it.

    I am new at creating reports with crystal reports and also vs2008.

    I have created a data source using the wizard to an MS Access DB which is password protected. Using this data source I have created a crystal report. The report runs just fine.
    However, the end user might decide to put the database on the network. How do I change either my data source connection or crystal reports to access the database in its new location. I have tried now for almost two days also search various threads, but can’t seem to find a workable solution.

    I possible, I would realy appreciate sample code.

    Please help.

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: Db Connection to crystal report

    I use the next code to change the datasource, but it's an external rpt, hope it helps
    Code:
        Public CRReport As CrystalDecisions.CrystalReports.Engine.ReportDocument
        Public CRTable As CrystalDecisions.CrystalReports.Engine.Table
        Public CRTLI As CrystalDecisions.Shared.TableLogOnInfo

    Code:
        '
        'code here
        '
        CRReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
        CRReport.Load(GRptPath & "SATInvoice.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)
        For Each CRTable In CRReport.Database.Tables
            CRTLI = CRTable.LogOnInfo
            With CRTLI.ConnectionInfo
                .ServerName = "MyServer"
                .UserID = "sa"
                .Password = "B1Admin"
                .DatabaseName = "Reports"
            End With
            CRTable.ApplyLogOnInfo(CRTLI)
        Next CRTable
        '
        'code here
        '
    Last edited by jggtz; Jan 15th, 2010 at 01:18 PM.

  3. #3

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Re: Db Connection to crystal report

    First I wish to apologise for only your post now only. I was out and could not get to my mail.

    I have found a work around. I basically created a separate db without any security. I write the report data to this db at run time, and clean out the db when the report closes.

    I would however love to try your code below. Cannot do it right now, but will let you know as soon as I have done so.

    I appreciate you effort. Thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width