Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 24th, 2008, 11:48 AM
Registered User
 
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?


  #2 (permalink)  
Old November 25th, 2008, 12:02 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 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
================================================== =========
 


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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 12:09 AM
IIS Problem with ASP Pages rodmcleay Classic ASP Basics 2 April 18th, 2004 08: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 08:54 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.