Solved

How to set Crystal Report Default connection to Integerated Security

Posted on 2012-04-10
7
1,602 Views
Last Modified: 2012-04-28
How to set Crystal Report Default connection to Integerated Security as a default connection so it never asks for the Username and password and instead uses the login. I am using crystal report for VS2010.

Paul
0
Comment
Question by:pauledwardian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37830798
I *think* you are talking about 2 different things.

It is better, I think, to let your Crystal Reports connection to sql server using SQL Server authentication mode.

This method is completely different from giving users access to crystal reports.

In your asp code, you can use windows integrated security mode to allow users access to the report.

So, in a nutshel, use Crystal Reports connection method to connect to sql server database.

Then use Windows Security to give users access to the report.

I hope this is clear. If not, let us know.
0
 
LVL 9

Assisted Solution

by:sevensnake77
sevensnake77 earned 500 total points
ID: 37830856
try this sample

  Dim rpt As New AccountingPassdue
        Dim myConnection As SqlClient.SqlConnection = New SqlClient.SqlConnection(HttpContext.Current.Application.Get("connectionstring"))

        Dim MyCommand As New SqlCommand("storedprocedure here", myConnection)
        Dim myDA As New SqlDataAdapter
        Dim myDS As New ConsolidatedStatement 'Dataset created
        '   Dim UserId As String
        Try
            'MyCommand.Connection = myConnection
            MyCommand.CommandText = "storedprocedure here" 'Stored Procedure
            MyCommand.CommandType = CommandType.StoredProcedure
            MyCommand.Parameters.Add(New SqlParameter("@Customer", SqlDbType.Char, (6))).Value =
 



            myDA.SelectCommand = MyCommand
            myDA.Fill(myDS, "spA1SAccountReview")
            rpt.SetDataSource(myDS)
            rpt.DataDefinition.SortFields(0).SortDirection = CrystalDecisions.Shared.SortDirection.AscendingOrder

            myConnection.Open()
            CrystalReportViewer7.ReportSource = rpt ' Connects to viewer using rpt
         
        Catch Excep As Exception
            'With Label2
            '    Label2.Visible = True
            '    .CssClass = "labelRed"
            '    .Text = Err.Description ""
            'End With

        End Try


        Dim oStream As MemoryStream
        ' using System.IO
        '  rpt.DataDefinition.SortFields("Billed").SortDirection = CrystalDecisions.Shared.SortDirection.AscendingOrder

        oStream = DirectCast(rpt.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat), MemoryStream)
        Response.Clear()
        Response.Buffer = True
        Response.ContentType = "application/pdf"
        Response.BinaryWrite(oStream.ToArray())
        Response.[End]()
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37830938
How did you set up the database connection for the report?

Is the SQL server setup for integrated security?

mlmcc
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pauledwardian
ID: 37831030
I added a group as the authorized user to have read and write access to the database. And added specific user to that group in the AD.
SO, HOW can I approach this then?
If you like to provide the code, PLEASE only C# since I have no idea about VB.NET.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37831069
You set report security when you create the connection to the report.

mlmcc
0
 
LVL 9

Accepted Solution

by:
sevensnake77 earned 500 total points
ID: 37832593
ConsolidatedPaidadj rpt = new ConsolidatedPaidadj();
SqlClient.SqlConnection myConnection = new SqlClient.SqlConnection(HttpContext.Current.Application.Get("ConnString"));

SqlCommand MyCommand = new SqlCommand("storedprocedure", myConnection);
SqlDataAdapter myDA = new SqlDataAdapter();
ConsolidatedStatement myDS = new ConsolidatedStatement();
//Dataset created
//   Dim UserId As String
try {
      //MyCommand.Connection = myConnection
      MyCommand.CommandText = "spA1SGetConsolidatedPaid";
      //Stored Procedure
      MyCommand.CommandType = CommandType.StoredProcedure;
      MyCommand.Parameters.Add(new SqlParameter("@parameter", SqlDbType.Char, (6))).Value = yourvalue;
      
      myDA.SelectCommand = MyCommand;
      myDA.Fill(myDS, "spA1SGetConsolidatedPaid");
      rpt.SetDataSource(myDS);
      myConnection.Open();
      CrystalReportViewer7.ReportSource = rpt;
      // Connects to viewer using rpt
}

catch (Exception Excep) {
      {
            Label2.Visible = true;
            Label2.CssClass = "labelRed";
            Label2.Text = Err.Description;
            
      }

}
0
 

Author Closing Comment

by:pauledwardian
ID: 37906899
Thanks!
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
I need help adding validation to my MVC.Net view 6 23
Debugging Html 8 32
Validating number not work with decimal 4 29
How to set focus on a dynamic control 18 28
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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