title: How to set database login infos (connection info) for crystal report vb.net?
body: <p>I am having a little problem getting Crystal Reports to set the logon.  I have it working in a number of reports but a couple for some reason have stopped working.  Attached is my logon script, I have stepped through it and the logon info is all there after every step.<br>
  What is even more unusual is that the report in visual studio will open with information OK</p>
  
  <pre><code>Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click
      Dim cryRpt As New ReportDocument
      Dim crTableLogonInfos As New TableLogOnInfos
      Dim crTableLogonInfo As New TableLogOnInfo
      Dim crConnectionInfo As New ConnectionInfo
      Dim crTables As Tables
      Dim crTable As Table
      cryRpt.Load("g:\dt2\rptMusterSheet.rpt")
      With crConnectionInfo
          .ServerName = "SERVERNAME"
          .DatabaseName = "DB NAME"
          .UserID = "sa"
          .Password = "xxxxxxx"
      End With
      crTables = cryRpt.Database.Tables
      For Each crTable In crTables
          crTableLogonInfo = crTable.LogOnInfo
          crTableLogonInfo.ConnectionInfo = crConnectionInfo
          crTable.ApplyLogOnInfo(crTableLogonInfo)
      Next
      CRV1.ReportSource = cryRpt
      CRV1.Refresh()
  End Sub
  </code></pre>
  
  <p>after stepping through I get this<a href="http://i.stack.imgur.com/WMIcp.jpg" rel="nofollow">Message Box</a></p>