-
September 6th, 2010, 08:24 AM
#1
Database Login Crystal Reports
Hi all !
When I'm calling my report, the Database Login prompt comes up (see picture). I know that you have to use the setDatabaseLogon method from the Reportdocument, but if I use it, only the username and the password will be filled in and I can't set the database name because that field is disabled..
How can I fix this ?
Last edited by KevinVGW; August 4th, 2022 at 06:55 AM.
-
September 6th, 2010, 12:42 PM
#2
Re: Database Login Crystal Reports
Give us more details, please
Windows version
Crystal Reports version
Application language & version
etc.
And post the relevant code where you call the rpt
JG
-
September 6th, 2010, 02:15 PM
#3
Re: Database Login Crystal Reports
Hi, thanks for your reaction..
I've made my Visual Basic.NET application in Visual Studio 2008 on a Windows 7 operating system.
The computers on which I want to run my application are using Windows XP. In Visual Studio 2008 I'm using Crystal Reports (10?? I'm not sure about that number, but it was installed with my Visual Studio) and in the report I'm making connection to a SQL Server 2005 that runs on my Microsoft Small Business Server 2008.
Here you have the code to open my report:
Dim cryRpt As New ReportDocument
cryRpt.Load("Kasticket.rpt")
cryRpt.SetDatabaseLogon("user", "password", "databasename", "database")
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
Dim crParameterRangeValue As New ParameterRangeValue
For i As Integer = 0 To crParameterDiscreteValueList.Count - 1
crParameterDiscreteValue.Value = crParameterDiscreteValueList.Item(i)
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields()
crParameterFieldDefinition = crParameterFieldDefinitions.Item(crParameterFieldDefinitionList.Item(i))
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
Next
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
-
September 6th, 2010, 10:50 PM
#4
Re: Database Login Crystal Reports
Try next code :
Code:
Public cryRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
Public CRTable As CrystalDecisions.CrystalReports.Engine.Table
Public CRTLI As CrystalDecisions.Shared.TableLogOnInfo
cryRpt = New CrystalDecisions.CrystalReports.Engine.ReportDocument
cryRpt.Load(Kasticket.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)
For Each CRTable In cryRpt.Database.Tables
CRTLI = CRTable.LogOnInfo
With CRTLI.ConnectionInfo
.ServerName = "MyServerName"
.UserID = "MyUserID"
.Password = "MyPassword"
.DatabaseName = "MyDBname"
End With
CRTable.ApplyLogOnInfo(CRTLI)
Next CRTable
'
'Your Parameters' code goes here
'
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
JG
-
September 7th, 2010, 07:43 AM
#5
Re: Database Login Crystal Reports
Hi Jggtz,
I have tried your code on my computer and it works fine. But I have the same problem when I tried it on another computer.. Everything is correctly filled in, except the Database name
-
September 8th, 2010, 01:03 AM
#6
Re: Database Login Crystal Reports
The executable file does works ok in your pc, but it doesn't in another pc?
Or are you running it in vb6 ide ?
Did you install your project in that pc?
Also, say the data source you use in CR to get access to server & db & tables
JG
-
September 8th, 2010, 03:08 AM
#7
Re: Database Login Crystal Reports
Done ! I can open my reports successfull on my other PC's.. I think that I made a wrong connection to my database.. I used SQL Native Client, but now I'm using Microsoft OLE DB Provider for SQL Server. Now I can edit my reports and my program can work.. Thanks for your help, this thread can be closed..
-
March 31st, 2014, 03:11 AM
#8
Re: Database Login Crystal Reports
crConnectionInfo.ServerName = "YOUR SERVER NAME";
crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
CrTables = cryRpt.Database.Tables ;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
full source.. Crystal Reports logon parameters
John
-
April 6th, 2014, 08:00 PM
#9
Re: Database Login Crystal Reports
If you study the code, it's exactly the same (coded in different way) but yours is 4 years later
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
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
|