From bafe3fbfac93e1ead5b398d44cbbb9f750d6c8ab Mon Sep 17 00:00:00 2001 From: Noneday <59395983@qq.com> Date: Thu, 14 Dec 2023 16:51:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BE=BE=E6=A2=A6=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++ end/reportWeb/Startup.cs | 3 +- end/reportWeb/appsettings.json | 77 +++++++++++++++++++--------------- end/reportWeb/reportWeb.csproj | 1 + 4 files changed, 50 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index b695ce1..d68fef5 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,9 @@ Database=dbname;Data Source=x.x.x.x;Port=3306;User Id=xxx;Password=****;Charset= pgsql 连接串 格式 server=ip地址;port=5432;uid=用户;pwd=口令;database=数据库;Pooling=true; + +达梦 连接串 格式 +Server=ip地址:端口; UserId=用户; PWD=口令; ``` 配置完毕后,按F5 刷新页面,点报表目录,正常的话,这是应该能看到所有的测试报表了 diff --git a/end/reportWeb/Startup.cs b/end/reportWeb/Startup.cs index d9099bc..d10eedd 100644 --- a/end/reportWeb/Startup.cs +++ b/end/reportWeb/Startup.cs @@ -234,7 +234,8 @@ public void ConfigureServices(IServiceCollection services) DbProviderFactories.RegisterFactory("Microsoft.Data.Sqlite", SqliteFactory.Instance); foreach(var one in Configuration.GetSection("DbProviderFactories").Get()) { - var ass = System.Reflection.Assembly.Load( one.DllName); + //var ass = System.Reflection.Assembly.Load( one.DllName); + var ass = System.Reflection.Assembly.LoadFrom(Path.GetDirectoryName(Environment.ProcessPath) + "/" + one.DllName + (one.DllName.EndsWith(".dll")?"":".dll")); DbProviderFactory f = ass.GetType(one.FactoryClass).GetField(one.InstanceName).GetValue(null) as DbProviderFactory; DbProviderFactories.RegisterFactory(one.Name, f ); diff --git a/end/reportWeb/appsettings.json b/end/reportWeb/appsettings.json index 599a0dd..5c7ab8a 100644 --- a/end/reportWeb/appsettings.json +++ b/end/reportWeb/appsettings.json @@ -39,38 +39,49 @@ "admin_user": "admin", "admin_password": "database!123", //"static_path": "", - "DbProviderFactories": [ - { - "name": "SqlClient", - "dllName": "Microsoft.Data.SqlClient", - "FactoryClass": "Microsoft.Data.SqlClient.SqlClientFactory", - "InstanceName": "Instance" - }, - { - "name": "Oracle", - "dllName": "Oracle.ManagedDataAccess", - "FactoryClass": "Oracle.ManagedDataAccess.Client.OracleClientFactory", - "InstanceName": "Instance" - }, - { - "name": "Npgsql", - "dllName": "Npgsql", - "FactoryClass": "Npgsql.NpgsqlFactory", - "InstanceName": "Instance" - }, + "DbProviderFactories": [ + { + "name": "SqlClient", + "dllName": "Microsoft.Data.SqlClient", + "FactoryClass": "Microsoft.Data.SqlClient.SqlClientFactory", + "InstanceName": "Instance", + "link_str": "Data Source=ip地址;Initial Catalog=数据库名字;Persist Security Info=True;User ID=用户;Password=口令;Min Pool Size=1;Max Pool Size=50;Connect Timeout=15000;Application Name=报表连接," + }, + { + "name": "Oracle", + "dllName": "Oracle.ManagedDataAccess", + "FactoryClass": "Oracle.ManagedDataAccess.Client.OracleClientFactory", + "InstanceName": "Instance", + "link_str": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip地址)(PORT=端口))(CONNECT_DATA=(SERVER = SERVER名字)(SERVICE_NAME = 数据库)));User Id=用户;Password=口令;", + }, + { + "name": "Npgsql", + "dllName": "Npgsql", + "FactoryClass": "Npgsql.NpgsqlFactory", + "InstanceName": "Instance", + "link_str": "server=ip地址;port=5432;uid=用户;pwd=口令;database=数据库;Pooling=true;" + }, - { - "name": "MySql", - "dllName": "MySql.Data", - "FactoryClass": "MySql.Data.MySqlClient.MySqlClientFactory", - "InstanceName": "Instance", - "link_str": "Database=dbname;Data Source=x.x.x.x;Port=3306;User Id=xxx;Password=****;Charset=utf8;TreatTinyAsBoolean=false;" - }, - { - "name": "odbc", - "dllName": "System.Data.Odbc", - "FactoryClass": "System.Data.Odbc.OdbcFactory", - "InstanceName": "Instance" - } - ] + { + "name": "MySql", + "dllName": "MySql.Data", + "FactoryClass": "MySql.Data.MySqlClient.MySqlClientFactory", + "InstanceName": "Instance", + "link_str": "Database=dbname;Data Source=x.x.x.x;Port=3306;User Id=xxx;Password=****;Charset=utf8;TreatTinyAsBoolean=false;" + }, + { + "name": "odbc", + "dllName": "System.Data.Odbc", + "FactoryClass": "System.Data.Odbc.OdbcFactory", + "InstanceName": "Instance", + "link_str":"Dsn=odbc数据源名称;" + }, + { + "name": "DaMeng", + "dllName": "DmProvider", + "FactoryClass": "Dm.DmClientFactory", + "InstanceName": "Instance", + "link_str": "Server=ip地址:端口; UserId=用户; PWD=口令;" + } + ] } diff --git a/end/reportWeb/reportWeb.csproj b/end/reportWeb/reportWeb.csproj index 7eeadea..da83836 100644 --- a/end/reportWeb/reportWeb.csproj +++ b/end/reportWeb/reportWeb.csproj @@ -21,6 +21,7 @@ +