Anvie
asked on
Remove Crystal Report LogOn The report you requested requires further information
Hi,
I ' am creating reports using crystal report included in visual studio 2005. I successfully can pass parameter programmically but every time I run the crystal report I receive this message:
The report you requested requires further information
Then ask me to enter the MS SQL 2005 Login password.
I would like remove that page and go directly to the report. In my connection string I declared the password. I dont know why it is still asking me to enter password again.
Please help me ;-(
Thanks!
I ' am creating reports using crystal report included in visual studio 2005. I successfully can pass parameter programmically but every time I run the crystal report I receive this message:
The report you requested requires further information
Then ask me to enter the MS SQL 2005 Login password.
I would like remove that page and go directly to the report. In my connection string I declared the password. I dont know why it is still asking me to enter password again.
Please help me ;-(
Thanks!
You also need to make sure that the server you deploy this to has the crystal reports runtimes installed. You can do that by creating an empty setup package and adding the crystalreports merge module into it. (or by installing visual studio on the server ;p)
I'll see if I can convert this code to vb for you also....give me a couple of hours and I'll get back to you.
I'll see if I can convert this code to vb for you also....give me a couple of hours and I'll get back to you.
Private Sub SetDBLogonForReport(ByVal connectionInfo As ConnectionInfo, ByVal reportDocument As ReportDocument)
'loop over each table in the reports and set the logon/connection info
Dim tables As Tables = reportDocument.Database.Ta
For Each table As CrystalDecisions.CrystalRe
Dim tableLogonInfo As TableLogOnInfo = table.LogOnInfo
tableLogonInfo.ConnectionI
table.ApplyLogOnInfo(table
'this line is crutial depending on how your sql server is configured table.Location = "dbo." + table.Location
Next
End Sub
ASKER
Hi I recieve this error:
Type 'CrystalDecisions.Web.Crys talReportS ource' in Assembly 'CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521 e1304' is not marked as serializable.
Type 'CrystalDecisions.Web.Crys
ASKER
I don't know if I did it right, this is my code:
Imports CrystalDecisions.CrystalRe ports.Engi ne
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page
Public ReportDocument As New ReportDocument()
Protected Sub CrystalReportViewer1_Init( ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
Dim connectionInfo As New ConnectionInfo()
'loop over each table in the reports and set the logon/connection info
Dim Tables As Tables = ReportDocument.Database.Ta bles
For Each table As CrystalDecisions.CrystalRe ports.Engi ne.Table In Tables
Dim tableLogonInfo As TableLogOnInfo = table.LogOnInfo
tableLogonInfo.ConnectionI nfo = connectionInfo
table.ApplyLogOnInfo(table LogonInfo)
'this line is crutial depending on how your sql server is configured
table.Location = "ETC." + table.Location
Next
End Sub
Thanks!
End Class
Imports CrystalDecisions.CrystalRe
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page
Public ReportDocument As New ReportDocument()
Protected Sub CrystalReportViewer1_Init(
Dim connectionInfo As New ConnectionInfo()
'loop over each table in the reports and set the logon/connection info
Dim Tables As Tables = ReportDocument.Database.Ta
For Each table As CrystalDecisions.CrystalRe
Dim tableLogonInfo As TableLogOnInfo = table.LogOnInfo
tableLogonInfo.ConnectionI
table.ApplyLogOnInfo(table
'this line is crutial depending on how your sql server is configured
table.Location = "ETC." + table.Location
Next
End Sub
Thanks!
End Class
ASKER
I tried different code but I still get the same error:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page
Public ReportDocument As New ReportDocument()
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
Dim pServerName As String
Dim pDbName As String
Dim pUserid As String
Dim pPwd As String
pServerName = "ETC01"
pDbName = "Matrix"
pUserid = "trinity"
pPwd = "trinity"
Dim crTable As Table
Dim crTables As Tables
Dim crTabLogonInfo As TableLogOnInfo
'/*** Information provider for connection with the Database ***/
Dim crConnectionInfo As New ConnectionInfo()
Dim intCnt As Integer
crConnectionInfo.ServerName = pServerName
crConnectionInfo.DatabaseName = pDbName
crConnectionInfo.UserID = pUserid
crConnectionInfo.Password = pPwd
'/*** To get the Database object ***/
crTables = ReportDocument.Database.Tables
For intCnt = 0 To crTables.Count - 1
crTable = crTables.Item(intCnt)
crTabLogonInfo = crTable.LogOnInfo
crTabLogonInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTabLogonInfo)
Next
End Sub
End Class
You need to load the reportDocument and specify the ConnectionInfo values.
ie
ReportDocument reportDocument = new ReportDocument()'//new report reportDocument.Load(report Path)'//lo ad the report .rpt file
connectionInfo.DatabaseNam e = "myDatabase"
connectionInfo.UserID = "myUsername"
connectionInfo.Type = ConnectionInfoType.CRQE '//SQL Server
connectionInfo.Password = "myPassword"
connectionInfo.ServerName = "localhost\SQLEXPRESS" ' the sql server
Also I'm not sure if you should be initialising the report inside the viewer_init event. Try moving it to page_load.
ie
ReportDocument reportDocument = new ReportDocument()'//new report reportDocument.Load(report
connectionInfo.DatabaseNam
connectionInfo.UserID = "myUsername"
connectionInfo.Type = ConnectionInfoType.CRQE '//SQL Server
connectionInfo.Password = "myPassword"
connectionInfo.ServerName = "localhost\SQLEXPRESS" ' the sql server
Also I'm not sure if you should be initialising the report inside the viewer_init event. Try moving it to page_load.
You definitely have the crystal runtimes installed on your webserver ?
There should be folders under C:\Program Files\Common Files\Business Objects\2.7 with the crystal runtime files.
There should be folders under C:\Program Files\Common Files\Business Objects\2.7 with the crystal runtime files.
ASKER
yes I do:
I change the code and now I recive different error:
Exception Details: System.Runtime.InteropServ ices.COMEx ception: The system cannot find the file specified
I check the path of my CR and it is correct.
Thanks!
I change the code and now I recive different error:
Exception Details: System.Runtime.InteropServ
I check the path of my CR and it is correct.
Thanks!
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page
Public ReportDocument As New ReportDocument()
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
Dim pServerName As String
Dim pDbName As String
Dim pUserid As String
Dim pPwd As String
pServerName = "ETC01"
pDbName = "Matrix"
pUserid = "trinity"
pPwd = "trinity"
Dim crTable As Table
Dim crTables As Tables
Dim crTabLogonInfo As TableLogOnInfo
'/*** Information provider for connection with the Database ***/
Dim crConnectionInfo As New ConnectionInfo()
Dim intCnt As Integer
crConnectionInfo.ServerName = pServerName
crConnectionInfo.DatabaseName = pDbName
crConnectionInfo.UserID = pUserid
crConnectionInfo.Password = pPwd
'/*** To get the Database object ***/
Dim Filepath As String
Filepath = Server.MapPath("./Report\TransactionDetails.rpt")
ReportDocument.Load(Filepath, OpenReportMethod.OpenReportByDefault)
crTables = ReportDocument.Database.Tables
For intCnt = 0 To crTables.Count - 1
crTable = crTables.Item(intCnt)
crTabLogonInfo = crTable.LogOnInfo
crTabLogonInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTabLogonInfo)
Next
End Sub
End Class
My first thought is that is would be an issue with the report path.
I tried this code and it worked ok.
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
Dim pServerName As String
Dim pDbName As String
Dim pUserid As String
Dim pPwd As String
pServerName = "localhost\SQLEXPRESS"
pDbName = "database"
pUserid = "username"
pPwd = "password"
Dim crTable As Table
Dim crTables As Tables
Dim crTabLogonInfo As TableLogOnInfo
'/*** Information provider for connection with the Database ***/
Dim crConnectionInfo As New ConnectionInfo()
Dim intCnt As Integer
crConnectionInfo.ServerName = pServerName
crConnectionInfo.DatabaseName = pDbName
crConnectionInfo.UserID = pUserid
crConnectionInfo.Password = pPwd
'/*** To get the Database object ***/
Dim Filepath As String
Filepath = Server.MapPath("dummy.rpt")
ReportDocument = New ReportDocument()
ReportDocument.Load(Filepath, OpenReportMethod.OpenReportByDefault)
crTables = ReportDocument.Database.Tables
For intCnt = 0 To crTables.Count - 1
crTable = crTables.Item(intCnt)
crTabLogonInfo = crTable.LogOnInfo
crTabLogonInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTabLogonInfo)
Next
CrystalReportViewer1.ReportSource = ReportDocument
End Sub
ASKER
Hello, yes the code above works but I am back to my original problem, it ask for password to run the report ;-( please help...
ASKER
any update on this please
ASKER
Is it posible you send me the actual app that already working? Please... I have deadline for this ;-(
Thank you!
Thank you!
What didn't work about the code?
Does the report show?
Does the report have a subreport?
mlmcc
Does the report show?
Does the report have a subreport?
mlmcc
ASKER
The report shows but it ask me for the database password and I dont want that.
I really appriciate your help on this.
Thanks
I really appriciate your help on this.
Thanks
Are you passing the correct password?
mlmcc
mlmcc
Here is the full codebehind file that I was using.
Ensure that your reportViewerControl has disable logon prompt set to false.
ie.
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"
EnableDatabaseLogonPrompt= "False" HasRefreshButton="True" />
The code below picks up the username etc from the web.config file.
If you still can't get it working I would check your password etc.
Ensure that your reportViewerControl has disable logon prompt set to false.
ie.
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"
EnableDatabaseLogonPrompt=
The code below picks up the username etc from the web.config file.
If you still can't get it working I would check your password etc.
Imports CrystalDecisions.Web
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Web
Partial Class DefaultPage
Inherits System.Web.UI.Page
Public ReportDocument As ReportDocument
Public ReportTitle As String
Public ReportFilename As String
Protected Sub InitReport()
Dim pServerName As String
Dim pDbName As String
Dim pUserid As String
Dim pPwd As String
pServerName = System.Configuration.ConfigurationManager.AppSettings("server")
pDbName = System.Configuration.ConfigurationManager.AppSettings("database")
pUserid = System.Configuration.ConfigurationManager.AppSettings("username")
pPwd = System.Configuration.ConfigurationManager.AppSettings("password")
Dim crTable As Table
Dim crTables As Tables
Dim crTabLogonInfo As TableLogOnInfo
'/*** Information provider for connection with the Database ***/
Dim crConnectionInfo As New ConnectionInfo()
Dim intCnt As Integer
crConnectionInfo.ServerName = pServerName
crConnectionInfo.DatabaseName = pDbName
crConnectionInfo.UserID = pUserid
crConnectionInfo.Password = pPwd
'/*** To get the Database object ***/
Dim Filepath As String
Filepath = Server.MapPath("dummy.rpt")
ReportDocument = New ReportDocument()
ReportDocument.Load(Filepath, OpenReportMethod.OpenReportByDefault)
crTables = ReportDocument.Database.Tables
For intCnt = 0 To crTables.Count - 1
crTable = crTables.Item(intCnt)
crTabLogonInfo = crTable.LogOnInfo
crTabLogonInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTabLogonInfo)
Next
CrystalReportViewer1.ReportSource = ReportDocument
End Sub
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
InitReport()
End Sub
End Class
ASKER
Hi, I recieved a logIn failed msg. I check my database connection and I am 100% it is correct. Please help me out. Thanks!
Below is my web.config file. I am newbie in this, I am sorry for the trouble.
Below is my web.config file. I am newbie in this, I am sorry for the trouble.
<?xml version="1.0"?>
<!--
-->
<configuration>
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="reportMappings" type="CrystalDecisions.Shared.ReportMappingHandler, CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null"/>
</sectionGroup>
</sectionGroup>
</configSections>
<system.web>
<compilation debug="true" strict="false" explicit="true">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</buildProviders>
<assemblies>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Enterprise.Framework, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Enterprise.InfoStore, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Enterprise.Desktop.Report, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</assemblies>
</compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<authentication mode="Windows"/>
<httpHandlers>
<add path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
</httpHandlers>
</system.web>
<location allowOverride="true">
<appSettings>
<add key="CrystalImageCleaner-AutoStart" value="true" />
<add key="CrystalImageCleaner-Sleep" value="60000" />
<add key="CrystalImageCleaner-Age" value="120000" />
<add key="Connection" value="server=ETC01;database=Matrix;uid=Trinity;pwd=trinity;pooling=false"/>
<add key="server" value="ETC01"/>
<add key="DataBase" value="Matrix"/>
<add key="username" value="Trinity"/>
<add key="Password" value="trinity"/>
</appSettings>
</location>
<system.webServer>
<handlers>
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<businessObjects>
<crystalReports>
<reportMappings>
<add reportName="TransactionDetails.rpt" path="TransactionDetails.rpt"/>
</reportMappings>
</crystalReports>
</businessObjects>
</configuration>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes I did changed 'enable login prompting' property on the report viewer control. I recieved a LogIn error.
I also tried to change my DB connection to OLEDB Provider for SQL Server but I still have the same error.
Please suggest me something what to do with this. I already created several reports in CR and I dont want to create it again in different tool because of this.
Thanks,
I also tried to change my DB connection to OLEDB Provider for SQL Server but I still have the same error.
Please suggest me something what to do with this. I already created several reports in CR and I dont want to create it again in different tool because of this.
Thanks,
Hi Anvie,
Did u get any Solution for this problem yet? i am facing the same problem. i am using it in Windows forms though.
While debugging, i found that the password is not set sometimes for the ConnectionIfo.password propert of some tables. this happens randomly. moreover, the CrystalReportDocument's DataSourceConnections[0].P assword .propert is set to the assigned password just while setting the logon info for the first table, and while setting the logon info for the remaining table, this property of CrystalReportDocument.Data SourceConn ections[0] .Password is lost. may be this is the reason that it prompts for the passsword/ Login Information during Runtime.
My problem is that i have to change the Database server during the runtime.
Moreover, as mentioned above, i am not able to see "Enable Login Prompting" propert for the ReportViewer Object, i am using CrystalReportViewer object in Windows Forms
Did u get any Solution for this problem yet? i am facing the same problem. i am using it in Windows forms though.
While debugging, i found that the password is not set sometimes for the ConnectionIfo.password propert of some tables. this happens randomly. moreover, the CrystalReportDocument's DataSourceConnections[0].P
My problem is that i have to change the Database server during the runtime.
Moreover, as mentioned above, i am not able to see "Enable Login Prompting" propert for the ReportViewer Object, i am using CrystalReportViewer object in Windows Forms
for Cryatal report's Data source give table instead of data set it works.
Example:
rptObjEMPReport.SetDataSou
The problem is that crystal caches the login info you used when you designed the report. So you need to loop over the tables collection and set the logon for each table in the report.
I've attached some code which has successfully worked for me in the past.
Open in new window