Solved

How to set Crystal Report Default connection to Integerated Security

Posted on 2012-04-10
7
1,520 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
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 28

Expert Comment

by:sammySeltzer
Comment Utility
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
Comment Utility
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
Comment Utility
How did you set up the database connection for the report?

Is the SQL server setup for integrated security?

mlmcc
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:pauledwardian
Comment Utility
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
Comment Utility
You set report security when you create the connection to the report.

mlmcc
0
 
LVL 9

Accepted Solution

by:
sevensnake77 earned 500 total points
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 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

11 Experts available now in Live!

Get 1:1 Help Now