简体   繁体   中英

C# Add Password to DataSet connection where ConnectionRef points to App.Config connection string

I have a DataSet.xsd file that has a TableAdapter with a MainSource DbSource. I want to override the connection string by adding a password in code (so as not to store the password in the App.Config file). The ConnectionRef points to a connection string in App.Config. How do I go about overriding that? I still want the base connection string stored in App.Config, but I want to replace the specific reference to add the password.

I found how to do it for the Entity framework, but I am not working with that, and even that response was rather unspecific as to where to put the code to override the behavior.

I was not able to figure out how to override the behavior. And, every time I make an update, Visual Studio overwrites my code, but I figured out that I can modify the system generated code in the DataSet.Designer.cs file. It is not an ideal solution, but since I needed some solution, it was the best I could come up with. It answers my question for now. Perhaps when I figure out how to word my question better, I can ask another one that may generate more responses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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