Web Form w/ DB Move EASY question

G

Guest

I have VB.NET web form set up with an Access DB in a local directory. I have
a local server set up on my box for the purpose of testing the application.
When I move the application to the web server, naturally the explicit path of
the database is wrong.
Is there a way to set my program to use a relative path, since my DB resides
in the same directory anyway? Do I need to explicitly go in to the files in a
text editor to change the path? I tried this route and it didn't work...

Thanks!
 
K

Karl Seguin

Just set the relative path and use Server.MapPath(relativePath) which will
get the full path for the current environemtn...or store the full path in
the web.config and then just change that when moving from one to the other..

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
G

Guest

Thanks for your response.
My app is a VB.NET web form, so the Q & A to this
is likely tied to the VB.NET enviroment.
The DB connection was specified in the GUI
using Server Explorer. Do you know where
to set the server.mappath(relativepath) via
the IDE? Your suggestion seems to suggest
how to configure the scripts, however, when
the app is compiled, it stores the path in
a .DLL. In short, where in the VB.NET IDE
do you configure the path and how? Thanks!
 
K

Karl Seguin

Expand the hidden text in your webform that says "Web Form Designer
generated code" and in the Init you should see this being set.

I'm not sure exactly where it is, but once you find it (you could simply do
a search for it) if you change it to Server.MapPath("myAccess.mdb") it
should, at runtime (not compiled time), get the full path..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
G

Guest

Great! Worked like a charm.

Swapped the function into the OleDB connection string and it worked like a
charm. Wouldn't have figured it out w/o you.

Cheers,

Will Cooper
 

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

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top