Hi if Crystal Report Send you the login form it's because he doesn't found the database credentials
TRY THIS
Private Sub AssignConnection(rpt As ReportDocument)
Dim connection As New ConnectionInfo()
connection.DatabaseName = "YourDataBaseName"
connection.ServerName = "YourServerAdress"
connection.UserID = "UserID"
connection.Password = "Password"
For Each table As CrystalDecisions.CrystalReports.Engine.Table In rpt.Database.Tables
AssignTableConnection(table, connection)
Next
For Each section As CrystalDecisions.CrystalReports.Engine.Section In rpt.ReportDefinition.Sections
For Each reportObject As CrystalDecisions.CrystalReports.Engine.ReportObject In section.ReportObjects
If reportObject.Kind = ReportObjectKind.SubreportObject Then
Dim subReport As SubreportObject = DirectCast(reportObject, SubreportObject)
Dim subDocument As ReportDocument = subReport.OpenSubreport(subReport.SubreportName)
For Each table As CrystalDecisions.CrystalReports.Engine.Table In subDocument.Database.Tables
AssignTableConnection(table, connection)
Next
subDocument.SetDatabaseLogon(connection.UserID, connection.Password, connection.ServerName, connection.DatabaseName)
End If
Next
Next
rpt.SetDatabaseLogon(connection.UserID, connection.Password, connection.ServerName, connection.DatabaseName)
End Sub
Private Sub AssignTableConnection(ByVal table As CrystalDecisions.CrystalReports.Engine.Table, ByVal connection As ConnectionInfo)
Dim logOnInfo As TableLogOnInfo = table.LogOnInfo
connection.Type = logOnInfo.ConnectionInfo.Type
logOnInfo.ConnectionInfo = connection
table.LogOnInfo.ConnectionInfo.DatabaseName = connection.DatabaseName
table.LogOnInfo.ConnectionInfo.ServerName = connection.ServerName
table.LogOnInfo.ConnectionInfo.UserID = connection.UserID
table.LogOnInfo.ConnectionInfo.Password = connection.Password
table.LogOnInfo.ConnectionInfo.Type = connection.Type
table.ApplyLogOnInfo(logOnInfo)
End Sub