473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Locating Database

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?
Nov 17 '05 #1
1 1253
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.AppSett ings( "dbLocation")))
HTH
--
Jurjen de Groot
G.I.T.S., Netherlands.
"J. Babe" <ba*****@hotmail.com> wrote in message
news:8b**************************@posting.google.c om...
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?

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: aleatory | last post by:
Hi Access masters, Sorry for asking a very simple question, but how could I locate source tables which have been linked into the Access database? The following is an ASCII- based screen shot: ...
2
by: sats2059 | last post by:
Hey Everybody, I am running a C# code that creates a database called Mobile.sdf SqlCeEngine engine = new SqlCeEngine ("Data Source = Mobile.sdf"); engine.CreateDatabase (); Now I am not...
2
by: hfk0 | last post by:
Hello, I'm a newbie here and was wondering anyone could help me with this. I have a simple ASP.NET 2 web application running perfectly fine with IIS and SQLServerExpress installed locally on...
0
by: dmlinliverpool | last post by:
I am running VS.net 2005 Express and Sql Server 2005 Express. The DB and VS are both on the same PC. I cannot connect to a database from within VS. In Database Explorer I click Connect To...
1
by: steve1rm | last post by:
Hello, I have a problem trying to connect a remote sql server. The error: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may...
0
by: snowman | last post by:
I have vb and sql server express 2005 installed locally. I cannot add a data connection in vb express. I keep getting the error "An error has occured while establishing......26 - Error Locating...
3
by: jundavid | last post by:
How would I locate a database object, e.g. table, using VBA? After locating the object how would I add a column or field to the table? Thanks! Dave
4
by: jobs | last post by:
Works great on my client when I test from vs.net 2005. Howevever, when I deploy to the web server, I get this error: remotely and local from the web server. An error has occurred while...
4
by: Ty | last post by:
Hi all Short version of my problem: i have a Datagrid (Flexgrid from ComponentOne) with a Datatable as source. I need to search a row in the datatable, using a primary key column in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.