Results 1 to 3 of 3

Thread: report database change

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    report database change

    Hi

    I call the crystal report in vb.net 2003 by below mention method
    but it will work if the database is same on which the crystal report
    is designed. but if i change the database on runtime then the report will
    not display the data from assign database table.

    VB Code:
    1. Private Sub cmdprint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdprint.Click
    2.         Dim fReportViewer As New frmReportViewer
    3.         Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
    4.         Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
    5.         fReportViewer.MdiParent = MainForm
    6.         fReportViewer.Show()
    7.         Me.Cursor = Cursors.WaitCursor
    8.         Try
    9.             CrRepDoc.Load(Application.StartupPath & "\Report\Master\StatusMaster.rpt")
    10.             CrRepDoc.Refresh()
    11.             For Each tbCurrent In CrRepDoc.Database.Tables
    12.                 tliCurrent = tbCurrent.LogOnInfo
    13.                 With tliCurrent.ConnectionInfo
    14.                     .ServerName = gl_Server
    15.                     .DatabaseName = gl_DataBase
    16.                     .UserID = gl_User
    17.                     .Password = gl_PassWord
    18.                 End With
    19.                 tbCurrent.ApplyLogOnInfo(tliCurrent)
    20.             Next tbCurrent
    21.             fReportViewer.ReportViewerSales.ReportSource = CrRepDoc
    22.         Catch Exp As Exception
    23.             MsgBox(Exp.Message, MsgBoxStyle.Critical, "General Error")
    24.         End Try
    25.         Me.Cursor = Cursors.Default
    26.     End Sub

  2. #2
    Addicted Member mabbas110's Avatar
    Join Date
    Oct 2005
    Location
    Karachi , Pakistan
    Posts
    172

    Re: report database change

    Well , first of all try not to use database name directly , try to use with DSN or any other method. Secondly if the database changes then u must do "Verify Database" first , otherwise it will give an error.
    Thanks and Regards,

    Muhammad Abbas

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    Re: report database change

    can you give an example of any other method other than DSN

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