title: Why Crystal reports asking for database login credentials?
body: <p>I have read all the question and answer about this question related in stackoverflow.</p>
  
  <p>But i can't get help from these question.</p>
  
  <p><strong>My code</strong> </p>
  
  <pre><code>Imports System.Data.SqlClient
  Imports System.Data
  Imports System.Windows.Forms
  Imports CrystalDecisions.Shared
  
  Partial Class Reports_LReport
  Inherits System.Web.UI.Page
  Public Report As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
  Public thisConnectionString As String = ConfigurationManager.ConnectionStrings("cnStringMain").ConnectionString
  Dim reportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument = Nothing
  
  
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
      Dim scriptManager__1 As ScriptManager = ScriptManager.GetCurrent(Me)
      scriptManager__1.RegisterPostBackControl(Me.FactroyAttendance)
  
      If Not IsPostBack = True Then
  
      Else
      LoadReport()
      End If
    End Sub
  
  
  Protected Sub cmdShow_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdShow.Click
      LoadReport()
  End Sub
  
  
  Private Sub LoadReport()
  
  
      If Me.reportDocument IsNot Nothing Then
          Me.reportDocument.Close()
          Me.reportDocument.Dispose()
      End If
      Dim SConn As New SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings("cnStringMain").ConnectionString)
      Dim thisConnection As New SqlConnection(thisConnectionString)
      Dim mySelectCommand As SqlCommand = New System.Data.SqlClient.SqlCommand("prLeaveStatusReport", thisConnection)
      mySelectCommand.CommandType = CommandType.StoredProcedure
      reportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument()
      Dim reportPath As String = Server.MapPath("~/Reports/JoyLeaveReport.rpt")
      reportDocument.Load(reportPath)
      Dim connInfo As New CrystalDecisions.Shared.ConnectionInfo()
      connInfo.ServerName = SConn.DataSource
      connInfo.DatabaseName = SConn.InitialCatalog
      connInfo.UserID = SConn.UserID
      connInfo.Password = SConn.Password
      Dim tableLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo()
      tableLogOnInfo.ConnectionInfo = connInfo
      For Each table As CrystalDecisions.CrystalReports.Engine.Table In reportDocument.Database.Tables
          table.ApplyLogOnInfo(tableLogOnInfo)
          table.LogOnInfo.ConnectionInfo.ServerName = connInfo.ServerName
          table.LogOnInfo.ConnectionInfo.DatabaseName = connInfo.DatabaseName
          table.LogOnInfo.ConnectionInfo.UserID = connInfo.UserID
          table.LogOnInfo.ConnectionInfo.Password = connInfo.Password
          table.Location = "dbo." + table.Location
      Next
  
  
      If String.IsNullOrEmpty(txtFrom.Text) Then
          reportDocument.SetParameterValue("@dateFrom", "")
      Else
          reportDocument.SetParameterValue("@dateFrom", Convert.ToDateTime(txtFrom.Text).ToString("yyyy-MM-dd HH:mm:ss"))
  
      End If
  
      If String.IsNullOrEmpty(txtEmployeeID.Text) Then
          reportDocument.SetParameterValue("@empId", "")
      Else
          reportDocument.SetParameterValue("@empId", txtEmployeeID.Text)
      End If
  
  
      If String.IsNullOrEmpty(txtTo.Text) Then
          reportDocument.SetParameterValue("@dateTo", "")
      Else
          reportDocument.SetParameterValue("@dateTo", Convert.ToDateTime(txtTo.Text).ToString("yyyy-MM-dd HH:mm:ss"))
  
      End If
  
          FactroyAttendance.ReportSource = reportDocument
          FactroyAttendance.DataBind()
          FactroyAttendance.ReportSource = reportDocument
          FactroyAttendance.DataBind()
  
  
  
  End Sub
  
  Protected Sub Page_Unload(ByVal sender As Object, ByVal e As EventArgs)
      If Me.reportDocument IsNot Nothing Then
          Me.reportDocument.Close()
          Me.reportDocument.Dispose()
      End If
  End Sub
  End Class
  </code></pre>
  
  <p>I have a from where i have three fields  1. Fromdate 2. Todate 3. EmployeeId </p>
  
  <p>My reports is working fine but when i am going to export the report in pdf or word it ask me for the value of parameters and database login.</p>
  
  <p><strong>Image 1</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Bbzso.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Bbzso.png" alt="enter image description here"></a></p>
  
  <p><strong>Image 2</strong>
  <a href="https://i.stack.imgur.com/5pZf8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5pZf8.png" alt="enter image description here"></a></p>
  
  <p><strong>Image 3</strong>
  <a href="https://i.stack.imgur.com/DkFEj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DkFEj.png" alt="enter image description here"></a></p>
  
  <p>So, i have explained from my site as much as possible.
  How could i solve it?
  And thanks in advance.</p>