Jump to content

Installing a Database


bibib

Recommended Posts

Hi,I need to create a page where the user will be able to install a new .mdb file at a specific location. So In this page, the user will only type the location/path where the .mdb file should be installed. I want the tables within the .mdb file to be created automatically (The tables will be the same everytime a new database file is installed).Is this possible to be done with ASP.NET? Either way, can you help me with the code or give me some references ?Thanks

Link to comment
Share on other sites

What if you created the .mdb file with all the appropriate tables and then simply made copies of it for the new users?Using the System.IO.File class, it could look something like this:

		string path = Server.MapPath("whatever/the/path/is/");		string originalFile = path + "template.mdb";		string newFile = path + "newfile.mdb";		if(System.IO.File.Exists(originalFile))		{			System.IO.File.Copy(originalFile, newFile);		}

Link to comment
Share on other sites

Hi jesh and thanks!So will the new file always be named newfile.mdb? It doesn't really matter in my case, I just need to demonstrate to my university that A new file can be created with specific tables once the user clicks on a function button on a page..Thanks again

Link to comment
Share on other sites

But you could always dynamically generate the name of the new file. You could also save it in different directories - perhaps based on a user id or some other data.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...