Crystal Reports Database Connection Issue on .NET Framework and .NET 7

I’m having trouble with Crystal Reports database connections using LijsDev.CrystalReportsRunner in .NET 7 and I had it working in my previous version of the project in .NET Framework.

Problem

On some machines, the .NET Framework version prompts for parameters already supplied in the code and fails to connect to the database. The .NET 7 version works fine on admin machines but non-admin users face connection issues on that sub report specificly because on all other report generation I don’t face these issues and the sub report et main report have the same sql connection.

Details

  1. ODBC Connection: Verified and connected to the correct database on all machines.
  2. User Account: Same user account (User:Password) is used and has necessary permissions.
  3. Explicit Connection Configuration: Code added to configure the connection for each table in the report.

Key Code

Create Report Method

private Report CreateReport(string reportName, string reportTitle)
{
    string serverName = ConfigurationManager.AppSettings["ServerName"];
    string databaseName = ConfigurationManager.AppSettings["DatabaseName"];
    string userId = "YourUser";
    string password = "YourPassword";

    var connection = CrystalReportsConnectionFactory.CreateSqlConnection(serverName, databaseName, userId, password);
    var report = new Report(reportName, reportTitle)
    {
        Connection = connection
    };

    ConfigureReportDatabase(report, serverName, databaseName, userId, password);

    return report;
}

private void ConfigureReportDatabase(Report report, string serverName, string databaseName, string userId, string password)
{
    foreach (Table table in report.Database.Tables)
    {
        TableLogOnInfo logOnInfo = table.LogOnInfo;
        logOnInfo.ConnectionInfo.ServerName = serverName;
        logOnInfo.ConnectionInfo.DatabaseName = databaseName;
        logOnInfo.ConnectionInfo.UserID = userId;
        logOnInfo.ConnectionInfo.Password = password;
        table.ApplyLogOnInfo(logOnInfo);
    }
}

Generate Report Code

private void RB_Print_BT_Extra_Click(object sender, EventArgs e)
{
    string ParametreList = "";
    DataTable Decompte;
    if (_idDecompte != 0)
    {
        Decompte = VariableGlobale._MyConnection.Open("Select * from TabDecompteEntete where IdDecompte=" + _idDecompte + ";");
        ParametreList = "IdProjet=" + _idProjet + "&";
        ParametreList += "IdDecompte=" + _idDecompte + "&";
        ParametreList += "NoDecompte=" + Decompte.Rows[0]["Numero"].ToString() + "&";
        ParametreList += "DateDecompte=" + Strings.FormatDateTime(Conversions.ToDate(DateDecompte), DateFormat.LongDate);
        (App.Current.MainWindow as MainWindow).CreateRapport(ConfigurationManager.AppSettings["ReportPath"] + "Bordereau.rpt", ParametreList, "Impression " + Text);
    }
    else
    {
        Interaction.MsgBox("Il n'y a pas de decompte pour ce bordereau, vous devez avoir au minimum 1 décompte pour imprimer", Constants.vbOKOnly, "Impression du decompte");
    }
}

Current Issue

  • The .NET Framework version prompts for parameters on some machines (see screenshot).
  • The .NET 7 version works correctly on admin machines.
  • Non-admin users face connection issues.
  • Parameters are supplied in the code (include login info), but the report still prompts for them.

Question

What could be causing this inconsistent behavior? How can I ensure that the connection and report parameters are correctly applied on all machines, regardless of user privileges?

I really wonder why I use the same function everywhere but just for that specific file I have all these issues about connection if all users are able to create a report with other rpt files.

Thanks!

Screenshot

Permission from User base on what the user I sent to the dbconnection info in my report.

Parameters Prompt asked (These prompts are already included in the parameters of the main report but for this subreport instead of taking the parameters from the main report, it wants me to write it manualy

For the translation it says: An external component generate an exception.

Additional Note: Don’t hesitate to ask me question and also I wanted to say that when I replace this sub report by the old one using a dead sql database source the any user can generate the report strangely. I’ve been one week on that issue since CrystalReport is such an old service.


Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật