|
-
Dec 26th, 2007, 12:06 PM
#1
Thread Starter
New Member
[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!
-
Dec 27th, 2007, 07:33 AM
#2
Lively Member
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
-
Dec 27th, 2007, 09:29 AM
#3
Thread Starter
New Member
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:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub ConfigureCrystalReports()
Dim reportPath As String = "F:\ProCoS\crystals\scrapreport.rpt"
MyCrystalReportsViewer.ReportSource = reportPath
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.DatabaseName = "CentralOps"
myConnectionInfo.UserID = "sql"
myConnectionInfo.Password = "hmpsql"
SetDBLogonForReport(myConnectionInfo)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ConfigureCrystalReports()
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
Dim myTableLogOnInfos As TableLogOnInfos = MyCrystalReportsViewer.LogOnInfo
For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
Next
End Sub
End Class
Last edited by ramerra; Dec 27th, 2007 at 09:40 AM.
-
Dec 27th, 2007, 09:32 AM
#4
Re: Crystal not reading database name
How are you connecting to the database initially?
-
Dec 27th, 2007, 09:38 AM
#5
Thread Starter
New Member
Re: Crystal not reading database name
Microsoft OLE DB Provider For SQL Server
-
Dec 28th, 2007, 03:11 PM
#6
Lively Member
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:
Dim ReportName as new ReportName
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|