Solved

Remove Crystal Report LogOn The report you requested requires further information

Posted on 2008-06-11
23
14,216 Views
Last Modified: 2013-11-26
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!
0
Comment
Question by:Anvie
  • 10
  • 9
  • 2
  • +2
23 Comments
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility
Ahh the perenial crystal logon issue. If I had a dollar for everytime I've encountered this!

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.

  ConnectionInfo connectionInfo = new ConnectionInfo(); //our connection details
 

            try

            {
 

                connectionInfo.DatabaseName = System.Configuration.ConfigurationManager.AppSettings["DataBaseName"].ToString(); // cms database change to production

                string username = Session["strUserCMSName"].ToString();//cms username 

                connectionInfo.UserID = username;

                connectionInfo.Type = ConnectionInfoType.CRQE; //SQL;//sql server 
 

                string password = Session["strUserPassword"].ToString();//cms password

                connectionInfo.Password = password;

                connectionInfo.ServerName = System.Configuration.ConfigurationManager.AppSettings["DataBaseServer"].ToString(); //changing to our production database server

            }

            catch (Exception ex) 

            {

                lblerror.Text = ex.ToString();

                return; 

            } 
 
 
 

  private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)

        {

            //loop over each table in the reports and set the logon/connection info

            Tables tables = reportDocument.Database.Tables;

            foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)

            {

                TableLogOnInfo tableLogonInfo = table.LogOnInfo;

                tableLogonInfo.ConnectionInfo = connectionInfo;

                table.ApplyLogOnInfo(tableLogonInfo);

                table.Location = "dbo." + table.Location;//this line is crutial for some sql configs - you may or not need it

            }

        }

Open in new window

0
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility
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.
0
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility

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.Tables
    For Each table As CrystalDecisions.CrystalReports.Engine.Table In tables
        Dim tableLogonInfo As TableLogOnInfo = table.LogOnInfo
        tableLogonInfo.ConnectionInfo = connectionInfo
        table.ApplyLogOnInfo(tableLogonInfo)
            'this line is crutial depending on how your sql server is configured        table.Location = "dbo." + table.Location
    Next
End Sub
0
 

Author Comment

by:Anvie
Comment Utility
Hi I recieve this error:

Type 'CrystalDecisions.Web.CrystalReportSource' in Assembly 'CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' is not marked as serializable.
0
 

Author Comment

by:Anvie
Comment Utility
I don't know if I did it right, this is my code:


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 connectionInfo As New ConnectionInfo()

        'loop over each table in the reports and set the logon/connection info
        Dim Tables As Tables = ReportDocument.Database.Tables


        For Each table As CrystalDecisions.CrystalReports.Engine.Table In Tables
            Dim tableLogonInfo As TableLogOnInfo = table.LogOnInfo
            tableLogonInfo.ConnectionInfo = connectionInfo
            table.ApplyLogOnInfo(tableLogonInfo)
            'this line is crutial depending on how your sql server is configured        
            table.Location = "ETC." + table.Location
        Next
    End Sub


Thanks!



   
End Class
0
 

Author Comment

by:Anvie
Comment Utility
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

Open in new window

0
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility
You need to load the reportDocument and specify the ConnectionInfo values.
ie

ReportDocument reportDocument = new ReportDocument()'//new report            reportDocument.Load(reportPath)'//load the report .rpt file
connectionInfo.DatabaseName = "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.


0
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility
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.
0
 

Author Comment

by:Anvie
Comment Utility
yes I do:

I change the code and now I recive different error:

Exception Details: System.Runtime.InteropServices.COMException: The system cannot find the file specified

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

Open in new window

0
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility
My first thought is that is would be an issue with the report path.
0
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility
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

Open in new window

0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Anvie
Comment Utility
Hello, yes the code above works but I am back to my original problem, it ask for password to run the report ;-( please help...
0
 

Author Comment

by:Anvie
Comment Utility
any update on this please
0
 

Author Comment

by:Anvie
Comment Utility
Is it posible you send me the actual app that already working? Please... I have deadline for this ;-(

Thank you!
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
What didn't work about the code?

Does the report show?

Does the report have a subreport?

mlmcc
0
 

Author Comment

by:Anvie
Comment Utility
The report shows but it ask me for the database password and I dont want that.

I really appriciate your help on this.

Thanks
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Are you passing the correct password?

mlmcc
0
 
LVL 8

Expert Comment

by:Wikkard
Comment Utility
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.
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

Open in new window

0
 

Author Comment

by:Anvie
Comment Utility
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.
<?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>

Open in new window

0
 
LVL 8

Accepted Solution

by:
Wikkard earned 500 total points
Comment Utility
It's hard to say exactly what the problem might be. What datasource are you using in your crystal report. Is is a SQL Server ? Try using the OLEDB Provider for SQL Server instead of the SQL Server Driver or SQL Native Client. I'm not sure why but this may make a difference, I've had this kind of problem in the past and was able to resolve it by using the OLEDB Driver instead of the straight SQL Server one.

Also you didn't mention whether you had changed 'enable login prompting' property on the report viewer control.  

Your web config looks fine. I think it's something else that is causing the problem. Unfortunately there many possilbe causes of this problem and its so badly documented by Crystal and Microsoft that it often takes trial and error to get it right.

You might also try recreating the report, and make sure that you verify the database in the report designer.

Sorry I can't offer much more help than this at this time. Persevere and you will figure it out in the end. I hear the crystal reports stuff is a bit better in Visual Studio 2008, however I can't be sure as I haven't tried it yet. Depending on the nature/complexity/requirements of the report you may find sql server reporting services to be easier to use. Personally I like the features of Crystal.

Let us know how you progress - your not alone with this problem.
0
 

Author Comment

by:Anvie
Comment Utility
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,
0
 
LVL 1

Expert Comment

by:kiranjjain
Comment Utility
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].Password .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.DataSourceConnections[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
0
 
LVL 2

Expert Comment

by:manojkumarps
Comment Utility

 for Cryatal report's Data source   give table instead of data set it works.

Example:

rptObjEMPReport.SetDataSource(dsEMPReport.Tables["procEMPReport1"]);
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now