Results 1 to 6 of 6

Thread: [RESOLVED] Crystal not reading database name

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2007
    Location
    Middletown, Ohio
    Posts
    3

    Resolved [RESOLVED] Crystal not reading database name

    Hello! I am new to this forum and VB2005 although I have coded extensively in VB6. I am also new to Crystal Reports. I have read the tutorial provided by Business Objects and I am running into a problem.

    When I go to pass the database login parameters everything but the Database name passes. When I run the program and open the report it displays a database logon screen with the username, password and servername displayed however the database name is blank and the box is grayed out.

    I am using Visual studio 2005 Professional with Crystal Reports.
    The database is a SQL 2005 database.

    Any help would be greatly appreciated!

  2. #2
    Lively Member
    Join Date
    Sep 2007
    Location
    Texas
    Posts
    98

    Re: Crystal not reading database name

    Check and verify the datasource on the report.

    If this is correct then make sure that you have access to the database you are trying to connect to.

    Hope this helps
    Working in VB2005 and SQL2005

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2007
    Location
    Middletown, Ohio
    Posts
    3

    Re: Crystal not reading database name

    It happens to all the reports that I have. I do have access to the database as I can preview the report from within the development environment. I am posting the code to see if that helps solve the issue.
    vb Code:
    1. Imports CrystalDecisions.CrystalReports.Engine
    2. Imports CrystalDecisions.Shared
    3. Public Class Form1
    4.     Private Sub ConfigureCrystalReports()
    5.         Dim reportPath As String = "F:\ProCoS\crystals\scrapreport.rpt"
    6.         MyCrystalReportsViewer.ReportSource = reportPath
    7.         Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
    8.         myConnectionInfo.DatabaseName = "CentralOps"
    9.         myConnectionInfo.UserID = "sql"
    10.         myConnectionInfo.Password = "hmpsql"
    11.         SetDBLogonForReport(myConnectionInfo)
    12.     End Sub
    13.  
    14.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    15.         ConfigureCrystalReports()
    16.     End Sub
    17.     Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
    18.         Dim myTableLogOnInfos As TableLogOnInfos = MyCrystalReportsViewer.LogOnInfo
    19.         For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
    20.             myTableLogOnInfo.ConnectionInfo = myConnectionInfo
    21.         Next
    22.     End Sub
    23. End Class
    Last edited by ramerra; Dec 27th, 2007 at 09:40 AM.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Crystal not reading database name

    How are you connecting to the database initially?

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2007
    Location
    Middletown, Ohio
    Posts
    3

    Re: Crystal not reading database name

    Microsoft OLE DB Provider For SQL Server

  6. #6
    Lively Member
    Join Date
    Sep 2007
    Location
    Texas
    Posts
    98

    Re: Crystal not reading database name

    For what its worth, back when i started using CR and VB.Net I used the method you described above, Ramerra. But i found it rather complicated and long winded and i do remember it throwing up a few errors as well. Can i suggest you try this and see if it works any better?

    1) Put a CrystalReportsViewer onto your form
    2) Add the report into your project using add/existing item
    3) The following code will then open your report in the CrystalReportsViewer

    vb Code:
    1. Dim ReportName as new ReportName
    2. Me.CrystalReportViewer.ReportSource = ReportName
    Working in VB2005 and SQL2005

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