How to set Crystal Report Default connection to Integerated Security

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
pauledwardianAsked:
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.

sammySeltzerCommented:
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
Seven priceFull StackCommented:
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
mlmccCommented:
How did you set up the database connection for the report?

Is the SQL server setup for integrated security?

mlmcc
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

pauledwardianAuthor Commented:
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
mlmccCommented:
You set report security when you create the connection to the report.

mlmcc
0
Seven priceFull StackCommented:
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

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
pauledwardianAuthor Commented:
Thanks!
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
Crystal Reports

From novice to tech pro — start learning today.