简体   繁体   English

C#Oracle动态连接字符串解决方案

[英]c# Oracle Dynamic Connection string solution

I have an application that connects to specific Oracle user & database with data provided by user through one little form. 我有一个应用程序,它通过用户通过一种小格式提供的数据连接到特定的Oracle用户和数据库。

User inputs Username, Password and host address and can connect to any user defined locally, in the oracle client's file: tnsnames.ora. 用户输入用户名,密码和主机地址,并且可以连接到oracle客户端文件tnsnames.ora中本地定义的任何用户。 That works fine, but I have a problem when designing a reports with devexpress (or any other reports designer tool) for that same application. 效果很好,但是在使用devexpress (或任何其他报表设计器工具)为同一应用程序设计报表时,我遇到了问题。

All devexpress reports are communicating with database tables through dataset which uses fixed, hardcoded values defined in the connection string in app.config. 所有devexpress报告都通过数据集与数据库表进行通信,该数据集使用在app.config的连接字符串中定义的固定的硬编码值。

The problem is that I can't have hardcoded values for connecting to database, because user can every time enter different values and connect to a different user on database, through that little connection form, when the application is already running. 问题是我没有用于连接数据库的硬编码值,因为当应用程序已经运行时,用户每次都可以通过该小的连接形式输入不同的值并连接到数据库上的其他用户。
So does anyone know the best way to deal with this? 那么,有谁知道解决这个问题的最佳方法?

I don't know, maybe replacing the connection string in app.config every time when user inputs connection data? 我不知道,也许每次用户输入连接数据时都会替换app.config中的连接字符串吗?

您可能有一个用于报告的静态连接字符串,以及一个用于Oracle数据库/用户连接的单独的字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM