Global connection

  • 13 years ago

    Hello;

    I am working on a registration system (windows form) using visual studio 2005

    1.how can I create global connection variable in my system

    2.how to modify the connection string by code (modify connection string in app.config)

     

    thank you

  • 13 years ago

     

    Hi!!

       Actualy there are sevaral ways u can do it. First is u can define ur connection varibale in a vb module. Other way is, declare connection variable as shared.

       In the case of connection string one way is the way is the way u mentioned. That is, defined it in app.config file. U can modify it at any time without recompiling the programme. Other way is. since in connection string, the changing variables are host name / DB name. So u can define those in an outside XML file and when application loading, u can read that xml file and can extract host name and the DB name. Then u can make the connection string.

    Hope this would help u !!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An expert is a man who has made all the mistakes that can be made in a very narrow field” - Niels Bohr