0

When working with SQL files in a VB.Net project, how can the connection parameters be saved for easier development?

There are SQL files in the project, to hold queries for use in the app. When one of the files is opened for editing & testing, the credentials & properties must be entered again - every time!

See screenshot below.

Anything in the Connect and Advanced Properties windows is lost each time the file is closed. The credentials are very long, so they must be copied & pasted, and some connection properties need to be set. To redo these every time is annoying & inconvenient.

How can the credentials & properties be saved in the project? (if possible)

Sidenote: I do understand credentials should not be hard-coded into the project, so that need not be discussed. This is just for development, and eventually I will harden it up so the credentials will not be in the project.

enter image description here

5
  • Can you store the connection string in the app.config (encrypted, as appropriate) and load it from there when needed?
    – Doug Deden
    Commented Jun 7 at 18:41
  • Sorry, I'm not sure how to do that.
    – spinjector
    Commented Jun 7 at 21:20
  • I'm not either. I haven't developed in VB for a long time. But I help deploy and maintain a lot of my co-workers' projects, and I know that they store encrypted connection strings in the app config files (or web.config for websites) so it's at least a possible solution. Maybe someone else will provide more details.
    – Doug Deden
    Commented Jun 8 at 0:35
  • 1
    I suggest you ask this question on StackOverflow since it's more about programming than database administration.
    – Dan Guzman
    Commented Jun 8 at 16:50
  • @DanGuzman I did. They beat me up & voted to close my question. So I came here because you guys are nicer, lol. stackoverflow.com/questions/78589223/…
    – spinjector
    Commented Jun 9 at 15:27

0