VB.NET app and Database Deployment

I hope someone can help me. I recently finished an application for a company using their access database. I am ready to install on a couple of PC's. It is a stand alone program. The problem is each PC is different. One has little or no storage space on C: the other has room on C:. Here is the problem... The setup will store the application where ever they want it to go but the database is hard coded for example c:datafiles. How can I get it to dynamically move say to any drive c: or d: and even shared network drives like S: or to G:, etc. or any place the user has room for just like the application. One user placed app on shared network F: with database on C: the other placed app on shared G: but had no room on C: so I must reconfig app to move database to may it work, this could become a big problem.... Both would like the database to follow the application..(for security and network backup)... Help I am a long time programmer by new to VB.

Comments

Well I think you spelled out for self, you should not hardcode resources for your applicaition. I will go ahead and assume most of your configuration is stored in the DB. Now of course you can't store the DB conneciton info in the DB itself. Instead store it in either the registry, or better yet in a XML config file. Microsoft is moving away from the registry so unless you are already using the regitry for settings just make a XML file to hold the config. There are Read and Write funcitons for XML files built in to the Dataset object in .NET and this would be the easiest way to accoplish this task.

[b][red]This message was edited by jbassmanp at 2005-9-27 6:9:56[/red][/b][hr]: Well I think you spelled out for self, you should not hardcode resources for your applicaition. I will go ahead and assume most of your configuration is stored in the DB. Now of course you can't store the DB conneciton info in the DB itself. Instead store it in either the registry, or better yet in a XML config file. Microsoft is moving away from the registry so unless you are already using the regitry for settings just make a XML file to hold the config. There are Read and Write funcitons for XML files built in to the Dataset object in .NET and this would be the easiest way to accoplish this task.: : ~rlc: Thanks rlc this sounds like it may be my best bet. Are there any good sources that will show me examples of this. I am under a time contraint and new to VB.net. I'm getting good with net but there seems to be a new hurdle in front of me quite often. I am good at emulating samples/examples.

In your app init before you make your first DB connection read and set the connection string in module or location where everythign in the code that needs it can access it.[code] 'somewhere Public m_DBConnection As String

: Example for getting the info to and from the file? I am not sure, here is how I would do.: : Make an XML file to hold connection string info...: [code]<?xml version="1.0" standalone="yes"?>: : : My connection string: : [/code]: : You can just make that file manually. If you want to be able to create it in your code.: [code] Dim l_ds As New DataSet("Database_Config"): Dim l_dt As New DataTable("Settings"): Dim l_dr As DataRow: : l_dt.Columns.Add("DBConnection", GetType(String)): l_dr = l_dt.NewRow(): l_dr("DBConnection") = "My connection string": l_dt.Rows.Add(l_dr): l_ds.Tables.Add(l_dt): : l_ds.WriteXml(".DBConfig.XML")[/code]: : In your app init before you make your first DB connection read and set the connection string in module or location where everythign in the code that needs it can access it.: [code] : 'somewhere: Public m_DBConnection As String: : : 'read value and make sure it is there: l_ds.ReadXml(".DBConfig.XML"): : : If l_ds.Tables(0).Rows.Count = 0 Then: 'no connection info found : : End If: : l_dr = l_ds.Tables(0).Rows(0): : If Convert.IsDBNull(l_dr("DBConnection")) Then: 'db string is null: : End If: : 'got it : m_DBConnection = CStr(l_dr("DBConnection"))[/code]: : ~rlc: will try don't have much time. may have to give what I have as a work on progress. Thanks rlc will study this and see what i can see. would be nice if vb.net had a built in users option to chose/selects and alters where the database is located..