Saya memiliki aplikasi .net 3.5 SP1 yang memiliki sejumlah laporan kristal tertanam (Versi 10.5). Laporannya akan berfungsi dengan baik di dev saya. lingkungan, tetapi ketika saya memindahkan kode ke produksi, pengguna mendapatkan jendela yang meminta kredensial login.
Sekarang saya tahu pertanyaan tentang bagaimana mengubah sumber data saat runtime telah ditanyakan dan dijawab berkali-kali di SO. Pertanyaan saya bukan bagaimana melakukannya, tapi apa kesalahan saya?
Apa yang terjadi adalah jendela login akan muncul dengan semua informasi tetapi kolom database kosong dan pengeditan dinonaktifkan pada kolom tersebut. Saat saya menelusuri kode dengan debugger, ConnectionInfo memiliki semua informasi yang benar termasuk nama database.
//InvoiceHistory is the crystral report that is an embedded resource
InvoiceHistory billingHistoryReport = new InvoiceHistory();
ConnectionInfo info = ReportUtilities.GetConnectionInfo();
ReportUtilities.ConfigureLogonInfo(billingHistoryReport,info);
crystalReportViewer1.DisplayToolbar = true;
crystalReportViewer1.ReportSource = billingHistoryReport;
crystalReportViewer1.Refresh();
//Static Function Code
public static void ConfigureLogonInfo(ReportDocument _report, ConnectionInfo _conn)
{
Tables ts = _report.Database.Tables;
TableLogOnInfo li = new TableLogOnInfo();
foreach (Table t in ts)
{
li = t.LogOnInfo;
li.ConnectionInfo = _conn;
t.ApplyLogOnInfo(li);
}
for (int i = 0; i < _report.Subreports.Count; i++)
{
Tables tbs = _report.Subreports[i].Database.Tables;
TableLogOnInfo sli = new TableLogOnInfo();
foreach (Table t in tbs)
{
sli = t.LogOnInfo;
sli.ConnectionInfo = _conn;
t.ApplyLogOnInfo(li);
}
}
}
public static ConnectionInfo GetConnectionInfo()
{
ConnectionInfo conn = new ConnectionInfo();
conn.Type = ConnectionInfoType.SQL;
conn.UserID = GlobalSettings.Default.DatabaseUser;
conn.ServerName = GlobalSettings.Default.ServerName;
conn.Password = GlobalSettings.Default.DatabasePassword;
conn.IntegratedSecurity = GlobalSettings.Default.UseIntegratedSecurity;
conn.DatabaseName = GlobalSettings.Default.DatabaseName;
return conn;
}
Ketika saya melalui VS 2008 dan membuka Crystal Reports -> Database -> Database Expert -> Properties
Database Type: OLE DB(ADO)
Provider : SQLNCLI10
Data Source: {My dev SQL SERVER SERVER Instance}
Initial Catalog: {My dev DB NAME}
User ID: {My dev User ID}
Integrated Security: false
EDIT: Setelah menghapus centang "Verifikasi pada Setiap Cetakan", masalah masih terjadi