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?
Albee_JAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Albee_JAuthor Commented:
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
0
Albee_JAuthor Commented:
That should of said 'all of my reports are setup using Smart Task"
0
mlmccCommented:
Wha t code are you using to call the reports?

mlmcc
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Albee_JAuthor Commented:
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>
0
mlmccCommented:
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
0
Albee_JAuthor Commented:
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.
0
Albee_JAuthor Commented:
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

0
Albee_JAuthor Commented:
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

0
Albee_JAuthor Commented:
Ok this is for anybody who has been trying to programmatically pass the logon code while using a crystal reports viewer.  Below is all the code you need, in the code behind the page that is holding yoru crystal reports viewer.... I post this because I had a heck of a time finding it..

Imports CrystalDecisions.Shared
Partial Class Admin_Default
    Inherits System.Web.UI.Page
    Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim reportPath As String = Server.MapPath("ShowDirectory.rpt")
        CrystalReportViewer1.ReportSource = reportPath
        SetDBLogonForReport(myConnectionInfo)
    End Sub
    Private Sub SetDBLogonForReport(ByVal myconnectionInfo As CrystalDecisions.Shared.ConnectionInfo)
        Dim myTableLogOnInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo
        For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
            myTableLogOnInfo.ConnectionInfo = myconnectionInfo
            myconnectionInfo.DatabaseName = "******"
            myconnectionInfo.UserID = "****
            myconnectionInfo.Password = "****

        Next
    End Sub

 
End Class
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Albee_JAuthor Commented:
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....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.