W.O.P.R   W.O.P.R Building new Access database    Help


Building the database. You need to know your directory layout from your ISP. On this server, there is a separate database directory outside webscope called database. So the path in ASP code is: Server.MapPath("/") + "\..\database\" Where Server.MapPath("/") is the webroot, and "\..\" takes you one level above the root. Only the internal ASP user has access to this directory, thereby preventing anybody from downloading the database directly. The field name in the form is database, so the code that creates the Database is: Dim databasename databasename = Request.Form("databasename") Response.Write " " + databasename Dim objADOXDatabase Set objADOXDatabase = Server.CreateObject("ADOX.Catalog") objADOXDatabase.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/") + "\..\database\" + databasename

When the database is created, you want to create an include file to be used everywhere you need access to the database. Here we call it commentdb.inc.asp, and place it in the /include_files directory. The include file will look like this: <% Dim oConn Dim oConnString Set oConn = Server.CreateObject("ADODB.Connection") oConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/") + "/../database/commentdb.mdb;Persist Security Info=False" oConn.Open oConnString %> There is a short intro here