Link to home
Start Free TrialLog in
Avatar of Albee_J
Albee_J

asked on

Turn Integrated Security ON in Crystal Reports

I am working in visual studio 2005 with a connection to SQL Server 2005.

I am trying to take all of my current crystal reports and turn off 'enable database logon prompting'

I have tried to set my report connections to use 'integrated' logon but it doesn't work.  I am displaying my reports with crystal reports viewer.

 Where do I go to put report username and password in the code to disable the logon prompt?
Avatar of Albee_J
Albee_J

ASKER

If it helps you any my reports are all set up using  Smart Task
"Configuring Database Logon Prompting in the Smart Task " See page 305 in attached document.
VS2005-Walkthroughs.pdf
Avatar of Albee_J

ASKER

That should of said 'all of my reports are setup using Smart Task"
Avatar of Mike McCracken
Wha t code are you using to call the reports?

mlmcc
Avatar of Albee_J

ASKER

Just the crystal reports viewer

<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
        DisplayGroupTree="False" EnableParameterPrompt="False" Height="50px" ReportSourceID="EnhancedLogo"
        Width="350px" />
    <CR:CrystalReportSource ID="EnhancedLogo" runat="server">
        <Report FileName="EnhancedLogoReport.rpt">
        </Report>
    </CR:CrystalReportSource>
</asp:Content>
This may show you how.  It is a tutorial on using VS2005 Crystal

http://www.businessobjects.com/global/pdf/dev_zone/VS2005_Walkthroughs.pdf

mlmcc
Avatar of Albee_J

ASKER

I posted that tutorial earlier in my original post.  It doesn't show me how to take existing reports and make them integrated.  Plus the area that shows the integration is not binding reports using the crystal reports viewer.
Avatar of Albee_J

ASKER

I found some possible code but I am getting the following errors;

Error      3      Name 'OpenReportMethod' is not declared.      C:\Users\jalbee\Documents\Visual Studio 2005\WebSites\FabtechSales\Admin\EnhancedReport.aspx.vb      37      39      C:\...\FabtechSales\
Error      4      Name 'ReportDocument' is not declared.      C:\Users\jalbee\Documents\Visual Studio 2005\WebSites\FabtechSales\Admin\EnhancedReport.aspx.vb      38      20      C:\...\FabtechSales\
Error      5      Value of type 'CrystalDecisions.CrystalReports.Engine.Table' cannot be converted to 'System.Web.UI.WebControls.Table'.      C:\Users\jalbee\Documents\Visual Studio 2005\WebSites\FabtechSales\Admin\EnhancedReport.aspx.vb      41      23      C:\...\FabtechSales\
Error      6      'LogOnInfo' is not a member of 'System.Web.UI.WebControls.Table'.      C:\Users\jalbee\Documents\Visual Studio 2005\WebSites\FabtechSales\Admin\EnhancedReport.aspx.vb      42      30      C:\...\FabtechSales\
Error      7      'ApplyLogOnInfo' is not a member of 'System.Web.UI.WebControls.Table'.      C:\Users\jalbee\Documents\Visual Studio 2005\WebSites\FabtechSales\Admin\EnhancedReport.aspx.vb      44      13      C:\...\FabtechSales\
Error      8      Name 'ReportDocument' is not declared.      C:\Users\jalbee\Documents\Visual Studio 2005\WebSites\FabtechSales\Admin\EnhancedReport.aspx.vb      47      45      C:\...\FabtechSales\

    Protected Sub InitReport()
        Dim pServerName As String
        Dim pDbName As String
        Dim pUserid As String
        Dim pPwd As String

        pServerName = System.Configuration.ConfigurationManager.AppSettings(" ")
        pDbName = System.Configuration.ConfigurationManager.AppSettings(" ")
        pUserid = System.Configuration.ConfigurationManager.AppSettings("")
        pPwd = System.Configuration.ConfigurationManager.AppSettings(" ")



        Dim crTable As Table
        Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables

        Dim crTabLogonInfo As CrystalDecisions.Shared.TableLogOnInfo

        '/*** Information provider for connection with the Database ***/
        Dim crConnectionInfo As New CrystalDecisions.Shared.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("EnhancedLogoReport.rpt")
        ReportDocument = New CrystalDecisions.CrystalReports.Engine.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

Avatar of Albee_J

ASKER

K making progress but now I am getting this error:

Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'report'. SQL State: 42000 Native Error: Error in File C:\Users\jalbee\AppData\Local\Temp\EnhancedLogoReport {597CBAF6-FE74-4C3D-80C2-9D9F1918E58F}.rpt: Unable to connect: incorrect log on parameters.
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 = " "
        pDbName = " "
        pUserid = " "
        pPwd = " "



        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("EnhancedLogoReport.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

ASKER CERTIFIED SOLUTION
Avatar of Albee_J
Albee_J

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Albee_J

ASKER

Crap ran into a glitch, if you have a report that has 'parameter' prompting on, I use it for year, sales rep, association the code won't work....