Locating Database

J

J. Babe

I've built an ASP.NET application. I have built a .DLL (VB.NET
classes) that handles the database transactions. The web page then
gets data via the VB.NET DLL.
I am having trouble with the location of the database, I was setting
the location to "C:\myDB.mdb" for testing purposes. I imported
System.Web into my VB DLL and used:
HttpContext.Current.Server.MapPath(".\bin\myDB.mdb")
to set the location of the database to the bin folder of my .ASPX
project. However, when I go to update the database I get the
exception:

'Operation must use an updateable query.'

How can I dynamically (programmatically) set the database location?
 
J

Jurjen de Groot

How about putting that information in the Web.Config file.

<appSettings>
<add key="dbLocation" value = "~\data\myDB.mdb" />
</appSettings>


vb.NET: get value from web.config

Dim dbLocation As String = context.Server.MapPath( CStr (
System.Configuration.ConfigurationSettings.AppSettings( "dbLocation")))


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top