My Crystal reports запрашивает логин базы данных во время загрузки.
Я использую VS2010 и MS access для разработки приложения. Я использую в этом crystal report.
Когда я запустил приложение в системе разработки, все отчеты были сгенерированы правильно.
Но когда я установил проект установки в другой системе, он запрашивает диалоговое окно входа в базу данных.
Я обнаружил, что он запрашивает только тогда, когда я использовал 2 таблицы для создания конкретного отчета.
раздел отчета:
Dim Report As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument Dim CrystalReportViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer = New CrystalDecisions.Windows.Forms.CrystalReportViewer Dim Adapter As New OleDb.OleDbDataAdapter Dim DataSet As New DataSet For I As Integer = 0 To UBound(TableName) Adapter = GetDataAdeptor(QueryString(I)) Adapter.Fill(DataSet, TableName(I)) Next 'Report In the report Folder Report.Load(Application.StartupPath & "\" & ReportName & "") Report.SetDataSource(DataSet) Dim logoninfo As New TableLogOnInfo() Dim conninfo As New ConnectionInfo() With conninfo .Type = ConnectionInfoType.CRQE .ServerName = Application.StartupPath & "\db.mdb" .DatabaseName = "db.mdb" .UserID = "Admin" .Password = "" End With Report.DataSourceConnections.Clear() For Each RTable As Table In Report.Database.Tables RTable.LogOnInfo.ConnectionInfo = conninfo logoninfo = RTable.LogOnInfo logoninfo.ReportName = ReportName logoninfo.TableName = RTable.Name RTable.ApplyLogOnInfo(logoninfo) Next 'Report.VerifyDatabase() If Not [Parameter] = "" Then Report.SetParameterValue(0, [Parameter]) CrystalReportViewer.ReportSource = Report CrystalReportViewer.RefreshReport() If DataSet.Tables(0).Rows.Count = 0 Then MessageBox.Show("No Records to Display") Else : Me.Panel1.Controls.Add(CrystalReportViewer) End If cnn.Close() End Sub
Вызов Отчета:
Dim TableName(0) As String Dim QueryString(0) As String <big>'Works Fine</big> If Me.RdobtnRecentlyUpdatedCompanies.Checked() = True Then TableName(0) = "companydetails" 'Pass The Table That you used in the crystal Report QueryString(0) = "SELECT * FROM companydetails where Date_Added_to_List_ >= #" & dtp_RUC_from.Value.Date & "# and Date_Added_to_List_ <= #" _& dtp_RUC_till.Value.Date & "# and ticker_<>'Private' order by company_name_" ' Pass the Query 'ReportForm.MdiParent = MainForm 'Pass For Mdi True Me.ViewReport("RUCReport.rpt", TableName, QueryString, ) End If <big>'Asks for DB Login</big> If Me.RdobtnSCompletionDate.Checked() = True Then If txtStudyPhase.Text.ToString() = "" Then TableName(0) = "dgdetails" QueryString(0) = "SELECT * FROM dgdetails where Date_Added_to_List_ between #" & _ Me.dtp_DSC_From.Value.Date & "# and #" & dtp_DSC_Till.Value.Date & _ "# and dgdetails.company_id in (select companydetails.company_id from companydetails where companydetails.tkr<>'Pri')" ' Pass the Query 'ReportForm.MdiParent = MainForm 'Pass For Mdi True Me.ViewReport("DSCDReport.rpt", TableName, QueryString, ) Else TableName(0) = "dgdetails" QueryString(0) = "SELECT dd.* FROM dgdetails as dd INNER JOIN companydetails AS cd ON dd.company_id = cd.company_id" & _ " WHERE dd.Date_Added_to_List_ BETWEEN #" & Me.dtp_DSC_From.Value.Date & "# AND #" & dtp_DSC_Till.Value.Date & _ "# AND dd.Current_Phase IN (" & Me.txtStudy.Text & ") AND cd.tkr <> 'Pri'" ' Pass the Query 'ReportForm.MdiParent = MainForm 'Pass For Mdi True Me.ViewReport("DSCDReport.rpt", TableName, QueryString, ) End If End If
Может кто-нибудь помочь мне выбраться из этого??? Чесание в течение 3 дней