title: Visual Studio Embedded Crystal Report Keeps Prompting Database Login?
body: <p>I'm using visual studio 2005 to develop a form with a combobox passing a value into the parameter of an embedded crystal report.  I'm trying to figure out why it keeps prompting me for a database login every single time you try to run the report with a different combobox selection.  </p>
  
  <p>Here is my code: </p>
  
  <pre><code>private Sub Form1_load... 
          Dim ConnName As String
          Dim ServerName As String
          Dim DBName As String
          Dim user As String
          Dim pass As String
          Dim gDBA As ADODB.Connection
          Dim records As ADODB.Recordset
          Dim datver As ADODB.Recordset
          Dim query As String
  
  
          '---OPEN THE DATABASE CONNECTIONS
          gDBA = New ADODB.Connection ': gDBA.CursorLocation = adUseServer
          'Added to prevent time out error
          gDBA.CommandTimeout = 1000 : gDBA.ConnectionTimeout = 1000
  
          gDBA.ConnectionString = "Server=svr13;Database=subscribers;User ID=KViews;Password=Solution;Trusted_Connection=True;"
  
          gDBA.Open("Data Source=Kaseya;Initial Catalog=subscribers;User Id=KViews;Password=Solution;", "KViews", "Solution")
  
          records = New ADODB.Recordset
  
          query = "select distinct groupname from _v_k order by groupname desc"
          'records.ActiveConnection = gDBA.ConnectionString
          records.CursorType = CursorTypeEnum.adOpenForwardOnly
          records.LockType = LockTypeEnum.adLockReadOnly
  
          records.Open(query, gDBA)
          Do While Not records.EOF
              ComboBox1.Items.Add(records.Fields("groupname").Value)
              records.MoveNext()
  
          Loop
  end Sub 
  
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
          Dim selected As String
          selected = ComboBox1.Text
  
          Dim cryRpt As New ReportDocument
          cryRpt.Load("C:\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\CrystalReport1.rpt")
          cryRpt.SetDatabaseLogon("KViews", "Solutions", "svr13", "subscribers")
  
  
          cryRpt.SetParameterValue("companyname", selected)
  
          CrystalReportViewer1.ReportSource = cryRpt
          CrystalReportViewer1.Refresh()
  
      End Sub
  </code></pre>
  
  <p>I looked at this previous posting <a href="https://stackoverflow.com/questions/1132314/database-login-prompt-with-crystal-reports">database login prompt with crystal reports</a></p>
  
  <p>but this wasn't very helpful.  I couldn't find where a CMC was to disable the prompt. </p>
  
  <p>Any ideas?  thanks in advance</p>