Hi Friends :cool: Am creating a personal diary application using VB.Net. When i publish the solution i get the .exe file. But when i install it, it gets installed in the C drive by default.
My question is cant it be installed in someother drive. If it cant someone pls tel me the way to change the location of the database from the default C drive.

>My question is cant it be installed in someother drive. If it cant someone pls tel me the way to change the location of the database from the default C drive.

Store database connection in app.config file and read it programatically.

1. Add app.config in your project (Application Configuration file.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <connectionStrings>
    <add name="CnStr"
          providerName="System.Data.OleDb"
          connectionString="put_here_your_connection_string"
         />
  </connectionStrings>
    <system.diagnostics>
         ..........
         .........
</configuration>

To read connection string,

1. Add the reference of System.Configuration
2. Use following code,

str=System.Configuration.ConfigurationManager.ConnectionStrings("CnStr").ConnectionString

Edited 5 Years Ago by __avd: n/a

thanks for the reply. But i hav already added the app.config file to the application. where should i add the sys.config code ?

System.Configuration.DLL is library file and you have to add the reference of this library into your project.

ya its working. but wats the use of the code which u gave ? Where ll the application be installed ? i dont want it to be installed in C drive

This question has already been answered. Start a new discussion instead.