p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Special Edition by Bill Evjen, Scott Hanselman, Devin Rader, Farhan Muhammad, Srinivasa Sivakumar; ISBN: 9780470041789

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 24th, 2008, 11:48 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2008
Location: Pawleys Island, SC, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Developing pages with IIS

As I did with ASP, I am using IIS to develop pages with asp.net. However, I cannot make relative addresses work. Here is my code:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Dim cn As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet .OLEDB.4.0;DataSource=~/committees.mdb;")
        Dim cn As New Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet .OLEDB.4.0;DATA SOURCE=" & _
                       "D:\websites\pbocchurch\church\aspx\committees.mdb ;")

        Dim da As New Data.OleDb.OleDbDataAdapter("select * from major", cn)
        Dim dt As New Data.DataTable
        da.Fill(dt)
        da.Dispose()
        cn.Dispose()
        Me.GridView1.DataSource = dt
        Me.GridView1.DataBind()
    End Sub

And at the top of the page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="connect2.aspx.vb" Inherits="connect2" Debug="true"%>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data" %>

Now, if I use a relative address in the connection string, ie,
("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & _
                       "committees.mdb;")

I get the following error: "Could not find file 'C:\WINDOWS\system32\committees.mdb'."

The problem is when I upload the completed file, the full address will be incorrect. How can I make relative addresses work in IIS?


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old November 25th, 2008, 12:02 AM
Wrox Author
Points: 12,827, Level: 49
Points: 12,827, Level: 49 Points: 12,827, Level: 49 Points: 12,827, Level: 49
Activity: 15%
Activity: 15% Activity: 15% Activity: 15%
 
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
Send a message via AIM to dparsons
Default

You need to do something like this:

"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & _
                       Server.MapPath("committees.mdb") & ";"

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run asp pages in IIS femina ASP.NET 1.0 and 1.1 Basics 20 February 22nd, 2006 12:31 PM
Cannot view asp pages with Win XP Pro (IIS 5.1) amonte Classic ASP Basics 6 January 23rd, 2005 06:16 PM
Hosting ASP .NET pages outside IIS sureshsundar007 General .NET 6 June 9th, 2004 01:09 AM
IIS Problem with ASP Pages rodmcleay Classic ASP Basics 2 April 18th, 2004 09:47 PM
Problems displaying web pages using IIS kathryne Classic ASP Professional 1 November 14th, 2003 12:48 PM



All times are GMT -4. The time now is 02:09 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc