gpt4 book ai didi

c# - 如何在FastReport Open Source中注册PostgreSQL

转载 作者:行者123 更新时间:2023-11-29 13:42:34 25 4
gpt4 key购买 nike

我正在测试 FastReport Open Source .告诉我,如何在报告中注册我的 PostgreSQL 数据库?我尝试在免费的 Designer Community 中创建报告,但只有 MS SQL。我理解正确,只有一种方法可以使用 Nuget 的包从代码构建报告吗?

最佳答案

使用最新版本 FastReport Open Source 2018.4.9 .它可以与 PotgreSQL 一起工作。 Designer Community 版本有一个原生的 PostgreSQL 连接器。您还需要添加 FastReport.OpenSource.Data.Postgres来自应用程序中的 NuGet。

在应用程序启动时执行一次以下代码:

FastReport.Utils.RegisteredObjects.AddConnection(typeof(PostgresDataConnection));

现在您应该能够从 Designer 或代码创建新的 PostgreSQL 数据源:

Report report = new Report(); 
report.Load(@"YourReport.frx");
//...
PostgresDataConnection conn = new PostgresDataConnection();
conn.ConnectionString = "your connection string";
conn.CreateAllTables();
report.Dictionary.Connections.Add(conn);

关于c# - 如何在FastReport Open Source中注册PostgreSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53080630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com